0

How to stop the code from completing the redirect if a PHP notice error happens? When working on Ubuntu local LAMP for development some notice errors are missed! But those same errors on the live server stops the header redirects.

What I am trying to do is catch those errors on the the local development server before they show up on the live server. How can I accomplish this? - headers already sent))?

Notice Errors:

enter image description here

Waqleh
  • 9,741
  • 8
  • 65
  • 103
  • What are those *some notice error*? – Bogdan Kuštan Jul 24 '16 at 09:18
  • @BogdanKuštan I added a screenshot – Waqleh Jul 24 '16 at 09:31
  • So show admin/Users.php files 1896 line. What framework are you using? What is your php.ini settings `error_reporting`, `display_errors`. These should be as mentioned in [this answer](http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display/21429652#21429652) – Bogdan Kuštan Jul 24 '16 at 09:39
  • @BogdanKuštan all errors show on the developer's PC, the problem is that unlike the Centos server to see these errors you need to stop the redirect function (comment it) after the notice error. – Waqleh Jul 24 '16 at 09:52

1 Answers1

1

Change this line in your php.ini in your Ubuntu server, and restart the web service:

output_buffering = 4096

to

output_buffering = Off

Alternatively, call ob_end_flush() before doing anything else in your Ubuntu server, but that makes the code inconsistent with the other environment.

user23013
  • 586
  • 5
  • 13