1

I had made a booboo in a script by writing <?php}?> instead of <?php }?>. My local Xampp server did not complain and happily served the file, while my actual server served a blank page and generated an error log (as would be expected, as <?php should be following by a space or line break).

This made me wonder why my local PHP is simply ignoring it.

I have compared both servers. My local server runs PHP 8.0.28 and remote server 8.0.30. Both servers have error reporting level E_ALL. PHP file header has error_reporting(E_ALL);

Local server php.ini error settings:

error_reporting=E_ALL
display_errors=On
display_startup_errors=On
log_errors=On

Yet, it still doesn't show an error (or notice, for that matter). When testing with a simple undefined variable to test the error level, it throws a notice - so the error reporting works fine. Also tested by echo error_reporting();, which echos 32767 (E_ALL).

Why is my local PHP not throwing an error?

5
  • Is the PHP version the same on both the local server and the actual server? Commented Apr 29, 2024 at 23:13
  • @NasserHajlawi The question says the local server is 8.0.28 and remote is 8.0.30. Commented Apr 29, 2024 at 23:49
  • @Barmar :D :D I read the question again after your comment one more time, but I couldn't find the version code. I used CTRL+F to search for it. :D I think I need some sleep. Commented Apr 29, 2024 at 23:52
  • I get a syntax error in both 8.2.7 and 7.4.33. Commented Apr 29, 2024 at 23:57
  • It might be worth inspecting the runtime values of the other settings using ini_get. Also, remember to only test this in the browser, not on the CLI Commented Apr 30, 2024 at 3:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.