Reaching out to others! Free & Open Source Software, Kannada, L10n, L18n Data Science, Cloud Computing & more…

Editing /etc/php.ini, or enabling few options via LxAdmin might not get work in LxAdmin servers. I faced this problem while trying to enable error logging. Whlie I was digging for the reasons, I found that each domain is provided with a separate php.ini under /home/httpd/domainname.com folder (replace domainname.com with domain’s name). php.ini found under this file needs to be edited in order to make the changes required for error logging etc.

If you use phpinfo() in a test php file, you can see that /home/user/__processed_stats/domainame.com.phplog file is quoted as the php error_log file. If you;re using suphp, ensure that this file is owned by the account user. If you use mod_php you might have to change this to apache.apache or permissions should be given for others to write into this file.

I wanted to change the log_error value for all accounts on the server. I accomplished the task by writing the following one liner.

#!/bin/bash
for i in `find /home/httpd -name php.ini`; do replace “log_errors = off” “log_errors = on” — $i; done

enJoy!