Categories
Coding Unix

PHP not fully recognizing php.ini

OK, here’s an odd one I encountered on one of my older servers running Apache2 and PHP 5.2.5

I had php scripts failing and generating “500” errors on the browser because they were running too long, or sometimes because a large file was being uploaded. I spent time playing with php.ini variables, only to find out that PHP wasn’t processing some of them!

Using phpinfo(), I noticed that the vars were not being set via php.ini, which I had set properly when it was compiled, ala:

‘./configure –with-apxs2=/opt/apache2/bin/apxs –with-mysql=/opt/mysql –with-zlib –with-config-file-path=/etc/php.ini –with-curl=/usr/lib64 –with-pear=/usr/share/pear –libdir=lib64 –with-pdo-mysql –with-gettext –enable-bcmath –with-oci8=instantclient,/home/instantclient10_1’ ‘–enable-sigchild –with-pdo-oci=instantclient,/home/instantclient10_1,10.1.0.5’

I didn’t want to risk affecting the system by re-installing PHP, so instead I found the workaround was to create a .htaccess file that contained:

php_value upload_max_filesize 8M
php_value max_execution_time 600

and this did the trick! So hopefully that helps anyone who is running this version of php and encountered this problem.