Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php directives in .htaccess?

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.

like image 676
ylluminate Avatar asked Nov 03 '22 00:11

ylluminate


1 Answers

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.

like image 171
mario Avatar answered Nov 09 '22 13:11

mario