add allow_url_fopen to my php.ini using .htaccess
Try this, but I don't think it will work because you're not supposed to be able to change this
Put this line in an htaccess file in the directory you want the setting to be enabled:
php_value allow_url_fopen On
Note that this setting will only apply to PHP file's in the same directory as the htaccess file.
As an alternative to using url_fopen, try using curl.
How can I set variable 'allow_url_fopen' in .htaccess or php file?
You can't, it can only be set in php.ini (see the docs), unless you're using a version of PHP <= 4.3.4.
If you're using a really old version of PHP (and you shouldn't be) then you can set it in PHP using ini_set
.
allow_url_fopen is on but phpinfo says off
I was able to find where allow_url_fopen
was switched off inside of WHM by editing the "MultiPHP INI Editor" section. From there I selected PHP7. The first option it gave me to to enable allow_url_fopen
. This fixed my error.
I couldn't find where allow_url_fopen
was disabled at all through SSH. I guess it is because I didn't understand the upgrade procedure from PHP5 to PHP7 and that I had PHP7 enabled only per account through cPanel though Root apeared to be still using PHP5 for php.ini.
How to set allow_url_fopen to true in Shared Hosting?
you can set it with your php file using ini_set()
function
for example to set display_errors
<?php
echo ini_get('display_errors');
if (!ini_get('display_errors')) {
ini_set('display_errors', '1');
}
echo ini_get('display_errors');
?>
check more from official document.
http://php.net/manual/en/function.ini-set.php
How to disable open_basedir and allow_url_fopen in PHP
You just need to comment out open_basedir
in php.ini
file and restart the server.
As:
;open_basedir
and this line in the .htaccess
file
php_value allow_url_fopen On
or you can add this line in php.ini
file
allow_url_fopen = On;
php.ini to affect all sub-folders
Regarding Mario's comment, I tried both php.ini
and .user.ini
. As he said php.ini
is not recursive, but .user.ini
is working recursively for me. I am also on 1and1 shared linux hosting with PHP5 as well. I just put the .user.ini
in my root directory.
Related Topics
Comparing Bcrypt Hash Between PHP and Nodejs
PHP JSON Encode Output Number as String
How to Add PHP Pagination in Array'S
How to Integrate Moneybookers in Web Application in PHP
The Correct Way to Delete All Files Older Than 2 Days in PHP
PHP Preg_Replace/Preg_Match VS PHP Str_Replace
Using Comparison Operators in a PHP 'Switch' Statement
Avoiding Recursion with Doctrine Entities and Jmsserializer
Zip All Files in Directory and Download Generated .Zip
Reading Ssl Page with Curl (Php)
Test PHP's Mail Function from Localhost
Sending Sms with Amazon Aws Services PHP
Printing a New Line in a CSV File Cell