Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0 - php

I upload my Laravel project on shared hosting. When I upload my project on the server it throws an exception then switched my PHP version 5.4 to 7.4. Now am facing this issue.
Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
I also disable the allow_url_include in my PHP ini file which exists in project root directory but it still says allow_url_include depreciated error.
Also, I go into the PHP Multi INI Editor and change the allow_url_include but it still throw the above error.

Remove .htaccess or change name to .htaccess.backup and WP will generate new file based on your site configuration

Log into your website host and navigate to your public_html folder and find the php.ini file. Open the file and find this code:
; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-include
allow_url_include = On
Change allow_url_include = On to allow_url_include = Off and save the file.
This should fix the error.
Additional detail located here:
https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-include

In case anyone comes across this:
Make sure that .htaccess files at all levels do not have conflicting code.
That is, I found that my ".../public_html/.htaccess" did not have any conflicts. However, I also had an .htaccess file in the folder level above that and it included code that read:
# Use PHP71 as default AddHandler application/x-httpd-php71 .php <IfModule mod_suphp.c> suPHP_ConfigPath /opt/php71/lib </IfModule>
Commenting this out resolved the error for me.

If your web host uses Cpanel, log in and under the Software section click Select PHP Version, then on the next screen click Options. Under Options, unclick allow_url_include:

Please Update PHP version of your site through CPanel to 7.3. This fixed the issue for my site. Thank you!

My client had 2 .ini files, conflicting max_input_var.
Deleting user.ini worked for me! Payment options were greyed out in WooCommerce. Now they are showing and this "allow_url" error is gone.

Related

How to fix PHP Deprecated Automatically populating $HTTP_RAW_POST_DATA is deprecated issue?

hello i'm getting this error in my error log:
"PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0"
My wordpress version is 4.8.1 and the php version is 5.6.30.
I tried fixing the issue by creating a php ini file and setting always_populate_raw_post_data value to -1. But i still get the error.
If it cannot be fixed, how can i prevent it prints on the error log?
I'm using a shared hosting.
how can i prevent it prints on the error log?
Your problem here is not that you cannot access php.ini and it is not that error shows.
Your problem, in fact, is that you use deprecated variable
instead, you could try using
file_get_contents('php://input');
php.ini is located somewhere in the php files on the server, which I assume you have no access to on shared hosting.
The php.ini file you created needs to be located where PHP expects to find its config files. You can see the configs which PHP is already loading using the phpinfo() function:
Upload a file named info.php with the following contents to your web server root:
<?php
// delete this file or comment out the below function when not in use
phpinfo();
?>
Then use a browser to navigate to http://yourwebsite.com/info.php. A page should load which tells you all about your php configuration. Look for the part near the top which shows information about the loaded configuration files. In particular, look for these entries:
"Loaded Configuration File" and "Scan this dir for additional .ini files".
If you have access to the .ini file listed as the Loaded Configuration File simply modify the value for always_populate_raw_post_data there. Otherwise, upload the .ini file you already created to the directory that is scanned for additional configuration files. Of course, you'll need to reload or restart php in order to reparse the configuration files.
If you don't have access to any of the locations listed from the above steps, it's possible your hosting provider may give you access to your php.ini file through cPanel or a similar means. Otherwise, your best bet is to contact them directly.
Finally, if you don't care about the actual configuration value as much as just suppressing the warning message, you could use the ini_set() function to set your error reporting to a different value, eliminating any deprecation warnings. The variable you want to set is "error_reporting" and a list of possible values can be found here.
In addition, since you are running WordPress there are some debug and error reporting options you can set in the wp-config.php file.
If your Account (on the shared hosting) using (or Configured) PHP-FPM, you can't do it via php.ini (if you create php.ini in your root, it will have no effect)
you can try: add this code
<IfModule mod_php5.c>
php_value always_populate_raw_post_data -1
</IfModule>
in your .htaccess file in your root directory, if not helps then ask the server admin (support) to change that in core php.ini globally for the given host.
You cant create a PHP.ini just like that. This is a core config file that is part of the PHP install. http://php.net/manual/en/configuration.file.php Read over this documentation to get a better idea of what the ini does.
The ini file could be located in multiple places depending on the OS and who installed it. If you do not have access to it, talk to your hosting provider

php include issue - works on one server... not another.. init file?

php "includes" are working fine on my current production server/site. (shared server)
I am moving this site to a new server and "includes" do not work. Error message:
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/xxxxx/public_html/publications/abss/myfile.php on line 140
In control panel I can set php version from 5.2 to 5.6 and generate init file. When I look at init file I find no "include" option to enable.
Questions:
Why is there no enable option in php.ini file? (I tried both 5.2 and 5.6 versions) Can I manually enter?
Does the php.ini file run each time a page is rendered?
How do I know if php.ini is actually in effect?
Thank you very much.
First of all check
phpinfo()
to see allow_url_fopen" and "allow_url_include" are ON
If not, you need to set them on OR contact your webmaster or hosting provider to enable allow_url_fopen and allow_url_include in the PHP server configuration.
I had tryed "allow_url_include" on but didn't work.
However, when I copied my init file from the old server to the new it worked fine. Not sure why. Didn't do a file compare.

Changing PHP.ini using htaccess on a Server

I am trying to use PHP's built-in function get_browser(). I followed the instructions in this useful post, but I'm still getting the error
browscap ini directive not set.
I downloaded the php_browscap.ini file and moved it into the same directory as my .htaccess file, so that its location is home/hostname/subdomain/php_browscap.ini Since I do not have access to my php.ini file, I am trying to edit the browscap property using .htaccess. This is what I entered:
php_value browscap home/hostname/subdomain/php_browscap.ini
I don't know if it matters, but below that there's some Rewrite Engine code.
As forementioned, I am still getting the error above. What did I do wrong?
Thanks.
The browscap PHP value has a changeable mode of PHP_INI_SYSTEM meaning it can only be set in php.ini or httpd.conf (not .htaccess).
Do a phpinfo() to understand your PHP runtime config. If your system is configure as "CGI/FastCGI" then it is probably running suPHP as the PHP initiator. In this case you can specify your own php.ini file. By default suPHP looks in the script directory but you can override this by the following directive in your .htaccess file:
suPHP_ConfigPath (expects a path name)
This option tells mod_suphp which path to pass on to the PHP-interpreter (by setting the PHPRC environment variable). Do NOT refer to a file but to the directory the file resists in.
E.g.: If you want to use "/path/to/server/config/php.ini", use "suPHP_Config/path/to/server/config".
If you don't use this option, PHP will use its compiled in default path.
Also you must use a properly formed path in your browsercap directive e.g.
browscap="/home/hostname/subdomain/php_browscap.ini"
(Note the leading /)
Addendum
I've just check and the Dreamhost shared hosting plan uses suEXEC. With suEXEC you can normally override the php.ini patch by copying the system php.ini (phpinfo() tells you where to find this) into a private directory, say _private as well as the browsercap.ini then adding
SetEnv PHPRC /home/hostname/_private
to your .htaccess file. If this doesn't work then the issue is specific to Dreamhost's suEXEC config and you need to ask this Q on http://discussion.dreamhost.com/
There are two potential problems here.
Perhaps your host does not allow you to override ini settings in the .htaccess file.
Maybe browscap does not like the path you have provided. Try:
php_value browscap /home/hostname/subdomain/php_browscap.ini
And ensure that permissions on that file allow the web user to read it.
If you are on a shared hosting and do not have access to the system php.ini then you can use the following standalone replacement of php's native "get_browser()" implementation.
https://github.com/garetjax/phpbrowscap

d13slideshow for WordPress and "URL file-access is disabled"

I'm taking my chances with WordPress 3.0 beta 1 (single user)
Unfortunately, i ran into problems with d13slideshow.
I configured the plugin to display 5 latest from a category, added <?php d13slideshow(); ?> to home.php, but it bombed:
function.getimagesize: URL file-access is disabled in the server configuration in /<snip>/wp-content/plugins/d13slideshow/d13slideshow.php on line 538
Warning: getimagesize(http://<snip>/wp-content/uploads/2010/04/featured-2-580x386.jpg) function.getimagesize: failed to open stream: no suitable wrapper could be found in /<snip>/wp-content/plugins/d13slideshow/d13slideshow.php on line 538
Is this a problem with the php setup or is there something I can do with the plugin or the function call from the template files to make it work?
http://wordpress.org/extend/plugins/d13slideshow/
It seems to be a configuration stuff... you will have to edit your php.ini and change the allow_url_include option from Off to On. For example
# nano /etc/php5/apache2/php.ini
; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
allow_url_include = On
Then, you will have to restart apache:
# /etc/init.d/apache2 restart
You will have to use the correct paths for your server ;)
Tell me if that works...
You may not have access to your php.ini file due to hosting restrictions. Ask you host or check for an update to that plugin.

How to turn off php safe_mode off for a particular directory in a shared hosting environment?

Hi I'm used shared hosting. I want to turn off php safe_mode off for my site. My provider gave me a php.ini file and asked me to put it with my settings in my public_html folder to override the settings, but it didn't work.
You can also try to create a file called php.ini in the root (public_html or other) folder, and putting the following in it:
safe_mode = Off
Depending on server settings, this may or may not work.
Your service provider might have forgot to tell you that you need to enable your user defined php.ini configuration by adding this line in the .htaccess file that you find in your public_html folder:
#Activates php.ini config located in main folder to work also recursively for all subfolders
suPHP_ConfigPath /home/YOUR_CPANEL_USER_NAME/public_html
Obviously replace YOUR_CPANEL_USER_NAME with your cPanel user name.
I'm supposing your server has got suPHP module(which is quite common in nowdays).
BTW: the php.ini file need to be in /home/YOUR_CPANEL_USER_NAME/public_html too and inside you should write this:
safe_mode = Off
And remember that Safe Mode is deprecated in PHP 5.3.0 and is removed in PHP 6.0.0.
TRY:
You can turn it off by adding the following line to a .htaccess file in your root (public html) folder.
If the .htaccess file doesn't exist, you can create it using a simple text editing program.
php_flag safe_mode Off

Categories