Setting PHP values using a .htaccess file
If your server runs in CGI mode like dso then you can’t use a php.ini file to change the values PHP can use. All of our reseller and hosting servers run SuPHP so you can use a php.ini file to modify PHP’s values. Here’s how to do this using a .htaccess file. As a default, we now use SuPHP so you should use a php.ini files to change the resource values of PHP. You can also use the MultiPHP INI Manager from cPanel.
The .htaccess file is usually found in each directory. You can’t see this file using PHP so you will need to use the inbuilt file manager or FTP to navigate to your home directory.
When using the file manager there is an option to “show hidden files” this should be ticked. To modify the values for the whole user account modify the .htaccess file that’s located in the public_html folder. To modify the values for a single folder navigate to that folder and find the .htaccess file inside it. You can then add your values for PHP to this file and save the document.
You must include the path to PHP in the top of the .htaccess file as shown below.
php_value include_path ".:/usr/local/lib/php"
php_flag display_errors Off
php_value upload_max_filesize 2M
How was this article? .htaccess php values
More from Dedicated Servers
Enable Mod_RemoteIP – See Visitors Real IP address when using Cloudflare & Apache
If you are using Cloudflare on your Apache server you will always see Cloudflare IPs in your logs and not …
Fix 413 Request Entity Too Large Errors When Using NGINX
Just like Apache, NGINX imposes default limits on the size of files that can be uploaded. A 413 Request Entity …
Cloud-init Modules That Automate and Customize Deployments
Cloud-init is a popular way to automate deployments of instances in a cloud or none cloud environment. To save having …