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
https://forums.phpfreaks.com/topic/147274-php-error-messages/
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
https://forums.phpfreaks.com/topic/147274-php-error-messages/#findComment-773201
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
https://forums.phpfreaks.com/topic/147274-php-error-messages/#findComment-773375
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.