|
It is possible to allow users to create their own php.ini files and load them instead of requiring a change to the master php.ini file on your server. You can do this for your accounts in order to tweak small settings or in order to allow users to re-write the entire php.ini file to their liking. In order to do this you will need to have your sever configured for suPHP. You can do this by submitting a trouble ticket to support or by following the following settings. You should be aware that changing to suPHP can cause existing scripts to break and websites to become inoperable. This is fixable however it should be noted so this change can take place during non peak hours. In order to change to suPHP you need to do the following:
- Log-in to your Web Host Manager as root
- On the left hand side scroll down to Service Configuration and select Configure PHP and SuExec from the list.
- On the drop down list you will need to select the handler for each PHP version you are running. You will need to select suPHP.
- Save your settings
- Restart your Apache (Web Server) via the link at the bottom of the left hand window.
This will change the fundamental way that your web server processes information with PHP. It allows scripts to run as the user name rather than nobody which adds security. The maximum file permissions allowed is 755 instead of 777.
This also helps prevent the exploitation of insecure permissions on files and folders. Also another added security feature is that if a file is owned by nobody it will give out an error. So the following steps will need to be taken place to resolve these.
- Change all files and folders that have a chmod value of 777 to chmod value of 755
- If a file is owned by user nobody this will need to be changed.
Now you are ready to setup a user or account to use a custom php.ini file. You can do this with the following steps:
- create a .htaccess file
- edit this file to include the following line:
SetEnv PHPRC /home/cPanelUserName/public_html/thepath/to/the/php.ini
- Once you have edited the .htaccess file you can now create the php.ini file that you specified above.
In that file you would put the values as you would see them in the default php.ini file. For example if you wanted to enable the value of max_execution_time to 300 you would use:
max_execution_time = 300
|