Back to Top

Where are the LOG of PHP,MySQL and Apache

About the LOG of PHP,MySQL and Apache

Today I am going to write about log which will help you to understand the concept of log in PHP, MySQL, and APACHE.The error log is a text file saved on your server.Entry will be added in this file when any error occurs. This file mainly for tracking an errors or warnings generated in the system.

Generally Error log contains information about the errors and Information are like date/time, user IP address Error message and object the user was requesting.The error message is also contained in Apache Log and it is important to pull error log data out of access log.

The main purpose of the error log is to keep track of all of the errors that occurred when your PHP pages were being accessed.

Let’s see error logs of main three PHP, MySQL and APACHE

Error logs of PHP

PHP is logging error for us but default setting of php.ini file for logging error is OFF so you have to turn on it to enable error log feature and which we highly commended. Also, you need to specify the path of the file where you want to save your error log in your php.ini file.

The typical error log entry looks like this:

In the above example, you can see that there was a parse error in the file test.php on line 14, which stops the execution of the particular page. Any user trying to see the contents of this file will see only the parse error until we get it fixed. So with the regular check of PHP error log, you will make sure there aren’t any errors in your code.

Error logs of MySQL

Like PHP, MySQL is also logging error and queries that happened with database transactions.By default, the error log is stored as hostname.err in the data directory of MySQL.Although You can specify other location where the error log is saved.

If you wanted to specify a different location for the error log, You can specify the [mysqld] section in my.ini file by using following the line of code.

MySQL also allows us to view every query sent to the server. To specify the location log for query, you need to type the following line of code:

NOTE: By default, Log file will be stored in the “data” directory with the name hostname.log file, unless you specify.Also Read about Types of Error Levels in PHP.

Error logs of Apache

Apache keeps both access logs and error logs.When Apache has been installed on your server, the default location for your log file is

Apachelogs.

Log Format of access log is

Let’s see access log entry and its looks like this:

By Default, Access log stored in the file access.log in Apache/logs.All of this information is on one line of the log and which is built by Apache.

However, an error log is stored in error.log file which contain any errors or warnings.

Let’s see error log entry and its looks like this:

Above Warning specifies that php_apc.dll file enables in PHP.ini file but it does not exist in PHP extension directory.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to add Tags in WordPress Pages?

Posted on 11 years ago

Bhumi

How to use Web service in WordPress?

Posted on 10 years ago

Bhumi