Question

I have attempted to make a few changes to php via .htaccess, yet none have yielded any results. For example:

php_value memory_limit 256M within will not activate.

Attempting to set SetEnv PHPRC /home/username/public_html/php.ini or any similar incantation, such as SetEnv PHPRC /home/username/some_path, will not work yield any difference in phpinfo. I DO see that _SERVER["PHPRC"] is indeed set, but no values are overwritten such as that noted above.

My phpinfo is as follows: https://gist.github.com/ylluminate/08efd9a2844723631214

I'm wondering if I'm missing an apache module that's not allowing this to work as expected for a custom php.ini or phprc. Further This is an Apache 2.4.4 installation on a VPS over which I have 100% control (Linode) and using WHM + cPanel.

Was it helpful?

Solution

Since PHP 5.3 you can use .user.ini files, given that PHP is setup to run via the CGI/FastCGI SAPI.
http://php.net/configuration.file.per-user

It's a simple extension of the main php.ini and allows specifying options equivalently:

memory_limit = 256M
upload_tmp_dir = /tmp

Usually you can place one of these in the DOCUMENT_ROOT. But every directory may contain one, so options may vary per script/folder. It's meant as full alternative to Apaches/mod_php .htaccess setting directives.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top