zssz Posted February 28, 2009 Share Posted February 28, 2009 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! Quote Link to comment Share on other sites More sharing options...
zssz Posted February 28, 2009 Author Share Posted February 28, 2009 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. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted February 28, 2009 Share Posted February 28, 2009 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 ?> Quote Link to comment Share on other sites More sharing options...
zssz Posted February 28, 2009 Author Share Posted February 28, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.