Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I copied my projects from my live site to the local system and running it as localhost.

In any module if there is an error then i can see a file error_log is created in the live server in that current directory.

How to do the same in the local system? what is the option i should add so that i can have error_log created in my localsystem

share|improve this question
up vote 1 down vote accepted

The values should already be set to defaults from the Apache install. Look/search through the config file for "ErrorLog" and it should give you the location to where the log is stored. The path to where the Apache config file exists depends on the version installed and your OS.

If that entry isn't found, you can add it to the configuration file like:

ErrorLog "c:\apache\logs\site_error.log" 


ErrorLog "/home/user/logs/site_error.log"

If you add this line to the config (which you shouldn't need to), restart Apache to apply the changes.


share|improve this answer
what if i want the error_log to be created in the folder of the currently executed file in which the error occurred. – Jayapal Chandran Oct 25 '12 at 14:03
Typically you wouldn't want that in a production environment, in Dev it would be ok, but that's not how I would typically set it up. In any case, whether the log was local to the dir the script was executing from or stored in another location, the error should/would be logged to that file as long as the Apache user had write access. – bmurtagh Oct 25 '12 at 14:07

Since the following is related to my question and since i am using this i am suggesting this alternate way of logging error through PHP. The answer i had accepted is for setting error log using apache.

another way to log error using php is using the php function error_log

$elog = "\r\n[".date('d-m-Y H:i:s',time())."] - [".$_SERVER['REMOTE_ADDR']."] - $string - in file $file in line $line";
error_log($elog, 0);
error_log($elog, 3, docroot."/error_log.txt");          
error_log($elog, 1, '');
  1. First one will write the error to the current modules error_log in the server(PHP's system logger).
  2. Second will write to your custom file and the
  3. Third will send the error to the email address specified.

Check the parameters section which will explain the usage of the various arguments.

share|improve this answer

Your Answer


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.