Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to trace down a script and have found that my problem is coming from httpd. To summarize that post, something is attempting to connect to a website and is [properly] being blocked by the server firewall. In my test script, attempting to connect to a website times out and generates a PHP warning in the page:

Warning: file_get_contents(http://foobar.com) [function.file-get-contents.html]: failed to open stream: Connection timed out in /home/foo/bar.php on line 3

This server runs with cPanel so I used the cPanel config editor to set error_log to /var/log/php-scripts.log and error_reporting to E_ALL. However, the warning from my test case is not showing up in /var/log/php-scripts.log (though the log is being populated by some PHP Startup warnings).

Can anyone point me in the right direction as to why the warning in my test script isn't being logged? I figure if I can get the timeout warning in my test script to log, then the timeout warning in the malicious script will also be logged and I can find where that script is hiding out.

Thanks!

share|improve this question
    
Have you checked the webservers log? It's (usually?) not logged in the same place as php errors. –  Nifle Sep 1 '10 at 19:15
    
No luck in the httpd error log. –  Joseph Sep 1 '10 at 19:24
add comment

1 Answer

Make sure that in your php.ini file, error logging is enabled. The following line should be enabled:

error_log = /var/log/php-scripts.log

You could also set it to

error_log = syslog

to log all errors to the syslog. After adding the line to your php.ini file, restart httpd like so

$ sudo /etc/init.d/httpd restart

cPanel might not be doing this properly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.