Introduction to php error logs

In this article I’m going to show you the basics of using php error logs to determine what’s really going on with the script that you’re trying to work on. Sometimes things will suddenly won’t work. Just like this time, the project that I have been working on, suddenly crumbles. And it turns out that mysql is not working  properly. You wouldn’t really know what’s the problem with your script if the browser just shows you something like this:

image

The solution to this would be to check out the php error logs. First thing that you need to do is of course, launch Wampserver. Right click on the tray icon. And make sure that logging of errors and tracking of errors is enabled in your php settings:

image

Make sure that those two are checked. Then after that, click on restart all services.

Next thing that you need to do is to run the script again. Make sure that you are opening the script that is not working properly. After accessing that and the page stopped loading. Check out the error logs.

To do that , just right click on the Wampserver tray icon. Select php then click on php error log. Open it up using Notepad or any text-editor.

You’ll see something similar to this:

 

[12-Feb-2011 23:50:01] PHP Warning:  mysql_connect() [<a href=’function.mysql-connect’>function.mysql-connect</a>]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

in X:wampwwwposphpconn.php on line 6

If you don’t have any idea on what the error logs is telling you, then there’s always Google to help you. This is just an introduction to php error logs. You might want to search for other information regarding this subject. Thanks for reading!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s