I wrote and executed PHP
code in the Terminal of Ubuntu.
In this case I got some errors. When I am using the Terminal it shows the error instantaneously. When the same code is run in a browser it doesn't show any error. Why does this happen, and how do I show the error in my browser?
Asked
Active
Viewed 1,172 times
0

Rob Hruska
- 118,520
- 32
- 167
- 192

user1728857
- 39
- 5
-
See http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors – Xiao Jia Nov 19 '12 at 13:29
-
see http://stackoverflow.com/questions/3057110/where-can-i-find-the-php-ini-for-php-cli – Zdenek Machek Nov 19 '12 at 13:30
2 Answers
3
command line php and regular, web php (such as apache's) have different php.ini files with different configurations
What you should do is to compare the two ini files and find what you need to correct.
Find error_reporting
and display_errors
directives.

tonino.j
- 3,837
- 28
- 27
-
not sure why this valid answer is cowardly, quietly downvoted. – Marcin Orlowski Nov 19 '12 at 13:32
-
Too generic, doesn't answer the question and looks like something that should have been a comment. – Repox Nov 19 '12 at 13:32
-
What is too generic for you? It clearly states there can be different ini this different configured PHPs – Marcin Orlowski Nov 19 '12 at 13:33
-
The updated answer is more specific and addresses the problem in the question. – Repox Nov 19 '12 at 13:43
1
Change error_reporting
to E_ALL
and display_errors = 1
in /etc/php5/cli/php.ini
or /etc/php/fpm/php.ini
and restart the web service.

edigu
- 9,878
- 5
- 57
- 80
-
Hi Foozy When I can't change the display = 1 because it shows in Read Only Formate. Now What Can do. – user1728857 Nov 20 '12 at 03:43