Jump to content

How to print PHP errors and warnings in the web browser?


dariyoosh

Recommended Posts

Hello everyone

 

 

OS: Fedora Core 17 (x86_64)

Browser: Firefox 18.0

PHP version: 5.4.11

Apache version: 2.2.22

 

 

I would like to know whether it is possible to print different kinds of PHP errors (at least parsing errors) in the browser screen. for example

<?php
myVariable = 12
?>

This should give a syntax/parse error because there is not $ before the variable name nor the ";" at the end of the statement.

 

I modified the file /etc/php.ini by removing comments for the two following options:

. . .

display_errors=On

; Default Value: On

; Development Value: On

; Production Value: Off

 

; display_startup_errors

; Default Value: Off

; Development Value: On

; Production Value: Off

 

error_reporting=E_ALL

; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED

; Development Value: E_ALL

; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

. . .

Then I restarted the apache service

# service httpd restart

 

Yet, I don't see any change, and whenever there is an error, I just have a blank page in the browser.

 

Any idea? What are the further actions to be taken in order to print errors and warnings on the screen? (Of course, I want to do this only for development/training purpose, here we are not talking about a production environment)

 

 

Thanks in advance,

 

Regards,

Dariyoosh

Link to comment
Share on other sites

Well, it seems that I made a mistake. I edited the file using vim and when I saw

; display_errors=

I thought this was the line to modify and uncomment, but in fact that was just the description section in the "Quick Reference". The actual line to modify is actually further down in the file.

 

Sorry for my mistake, it works now!

 

 

Regards,

Dariyoosh

Link to comment
Share on other sites

Thank you very much both of you for your time and your attention to my question.

I will pay attention to phpinfo() for future reference.

 

For just viewing the PHP directives, I wrote the following which provides the info

<?php
phpinfo(INFO_CONFIGURATION);
?>

 

 

Regards,

Dariyoosh

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.