How can I set up custom PHP settings on my web host?
In today business world website plays an important role and for this reason today a lot of businesses are using the website and web hosting service. And the other reason to use the website is that they can easily share the information of their product and service and along with that they can even showcase their services and products to all the people around them and also to the people across the globe.
So today if you are using web hosting service for your website and now if you are looking for information on how to set up custom PHP settings and also change custom local PHP settings of your web hosting then here is the complete information on it. So today if you are using shared hosting for your website then you may have trouble with local php.ini settings because in there you cannot change the server php.ini and using local php.ini files is not connecting by default.
Here is the information on how to set up custom PHP settings:
>>> Log into your SSH
>>> Now you need to create a custom php.ini file with the php values you need and below is how Your php.ini file should look like this in your file manager or ftp client. Take John as a cPanele username:
-rw-r--r-- 1 john1 john1 10 Apr 18 19:94 php.ini
>>> So once after creating the blank php.ini file you also need to override the security concerns. Because php will revert to an absolute base configuration, where some applications may throw a fit because certain extensions aren't enabled. A way around this is to copy the system php.ini and this can be accomplished by using the below command.
cp /opt/cpanel/ea-php56/root/etc/php.d/local.ini > /home/USERNAME/public_html/php.ini
>>> Once after creating your php.ini file now you can populate it with the php configuration values that you need to override on the server. so use the below command
phpconfigValueToOverride = value
>>> For example, say that the server default upload_max_filesize is 2M but if you want to increase then you can increase the value by creating your own php.ini file and using the below command
upload_max_filesize = 10M
>>> And once after creating a custom php.ini those changes will only have an effect on the scripts in the same directory. So use the below command code into a .htaccess file-
#Use local php.ini file recursively from public_html
SetEnv PHP_INI_SCAN_DIR /opt/cpanel/ea-php56/root/etc/php.d/:/home/USERNAME/public_html/
>>> Before starting you need to replace your cPanel username. So using the above code will make the PHP configuration values in your public_html/php.ini file and this will apply to all of the subdirectories of .htaccess file.
>>> One of the most common setups is to place your custom php.ini at public_html/php.ini and then place the .htacceess file at your public_html/.htaccess.
Here is the information on How to change custom local PHP settings:
>>> Sometimes there will be a lot of errors in Zend and other PHP extensions in the php.ini. And when you create a php.ini then you need to copy the server php.in into your public_html and next you need to modify the necessary lines. So you need to use the below command
cat /usr/local/lib/php.ini >> /home/username/public_html/php.ini
>>> So in here it will take whatever is in /usr/local/lib/php.ini and add it to a php.ini in the respective directory. And to make a php.ini file recursive you need to place this in a .htaccess file using the below command