Jump to content

PHP Error Messages


Recommended Posts

So, I've installed PHP 5.2.1 onto my Linux VPS, everything works great.

 

I have one problem though, I cannot seem to get error messages to display on a webpage if there are errors. To view the errors, I need to go into the control panel (LXAdmin) and click on the 'Error Logs' section.

 

How can I make it so I can enable errors to be displayed on the page and whenever there is an error, it writes to a file like 'ERROR_LOG' in the directory in which the error occurred?

 

If the second part of the question is a little too complex to explain here, the first part would be enough.

 

Thanks!

Link to comment
Share on other sites

Alright, I solved the first problem (trying to get the error messages to display on page), it required me moving php.ini into the directory. Now I need to find a way to log the errors into a log file in the same directory as the script is running.

Link to comment
Share on other sites

If you want to log errors globally then setup the error_log directive to the location you want all errors to be logged to. You should also enable the log_errors directive too

 

However if you want to log errors temporarily to different location the use ini_set within you script eg

<?php
ini_set('log_errors', 'On');
ini_set('error_log', '/path/to/your/script/error.log');

// rest of your code
?>

Link to comment
Share on other sites

How can I make it log the errors to the directory where the erroneous script is?

They had this on a shared hosting environment I used to buy hosting from, and I didn't have to include anything in front of the script. I didn't need a new php.ini in every directory on that host either. Just one in public_html and everything worked fine.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.