2
I write my code in the Sublime and when I try to run the Chrome screen it goes blank. As a comma can cause a lot of problems, I keep rereading and rereading code looking for errors. Because my Chrome does not indicate errors?
2
I write my code in the Sublime and when I try to run the Chrome screen it goes blank. As a comma can cause a lot of problems, I keep rereading and rereading code looking for errors. Because my Chrome does not indicate errors?
4
Place at the beginning of your code:
ini_set('display_errors',1);
ini_set('display_startup_erros',1);
error_reporting(E_ALL);
and if you have error_reporting(0), comment:
//error_reporting(0);
Thanks for the tip. I included the methods in my code and now, in fact, the browser indicates something instead of a blank page. But I need help understanding what the problem is. I’ll paste the errors here: Fatal error: Uncaught Error: Call to private carro::__Construct() from invalid context in /Applications/MAMP/htdocs/POO - PHP/Teste/index.php:15 Stack trace: #0 {main} thrown in /Applications/MAMP/htdocs/POO - PHP/Teste/line.php on 15
indicates me a source to better understand these methods.
Check out these videos: https://www.youtube.com/channel/UCPs8o9v3gVkIYfO1jlbb5jA
About the error: https://stackoverflow.com/questions/1997721/fatal-error-call-to-private-myobject-construct-invalid-context
As a continuation of my studies, I found a simpler way to identify PHP code errors. Locate the php.ini file and search the line 'display_errors = off' and change to 'display_errors = on'. Done! With this errors will appear naturally as soon as the HTML is loaded.
1
PHP is interpreted by the web server (apache, Nginx) and its response is delivered to the caller (browser, ajax). To view any errors that may occur you must enable the display of PHP errors in the file php.ini
there is a directive called display_errors
change its value to 1
or On
. So when errors occur they will be displayed on the screen.
1
Place these two lines at the beginning of your code that will make PHP report and show ALL the errors and warnings:
ini_set('error_reporting', E_ALL); // mesmo resultado de: error_reporting(E_ALL);
ini_set('display_errors', 1);
If you want your entire environment to display such errors and warnings, change these same directives in the PHP configuration (file php.ini
) and restart the HTTP server (Apache/IIS/Nginx/etc).
Example of configuration of error_reporting
:
Obs.: lines started by semicolon ;
are comments. Configuration is by line:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
Options are available in the documentation.
More details, see documentation:
Browser other questions tagged php google-chrome
You are not signed in. Login or sign up in order to post.
It wouldn’t be because php is read and interpreted by php server and not by the browser? Unlike javascript and html, PHP does not go to the browser.
– user28595
You can install this plugin in Sublime, http://www.sublimelinter.com/en/latest/, it identifies errors such as missing
;
or lock keys, so you don’t have to look for it in the code.– Dobrychtop
Got it. Despite that, I’m following the lessons of the Video Course, and in his case, the browser always reports the errors, same as javascript.
– Julio Barreto