0

I have several php errors that appear on the page as: Notice: Undefined index I have /etc/php/5.6/fpm/php.ini with display_errors = Off

When I set the value to On, I find even more errors on the page.

My htaccess file is empty and vHost conf is :

<VirtualHost *:80>
        ServerName website1.tld
        DocumentRoot /home/website1

        ErrorLog /var/log/sites/ website1_error_log
        CustomLog /var/log/sites/ website1_access_log combined

        DirectoryIndex index.php index.html index.htm index.php4 index.php5

        <Directory /home/website1>
                Options -Indexes +FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        <FilesMatch \.php$>
                SetHandler "proxy:unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost/"
        </FilesMatch>
        RewriteEngine on
</VirtualHost>

Thank's

12
  • 1
    Surely the answer is to fix the errors then rather than suppress them. Commented Dec 29, 2018 at 12:43
  • 1
    Then please show the code where the errors occur. Do not hide the errors, solve them! Commented Dec 29, 2018 at 12:43
  • It's a big production website and I can not correct thousands php errors. On the old server, errors are not displayed Commented Dec 29, 2018 at 12:46
  • Have you changed php version? "I can not correct thousands php errors" - how would you know the website is working as intended then? Commented Dec 29, 2018 at 12:48
  • 1
    @Jeto - errors such as failing to allocate a resource or failure in connecting to some API are genuine errors which should be logged and investigated - I can understand that. But Notice: Undefined index messages are sloppy coding and potential indicators that the quality of code is generally suspect. Commented Dec 29, 2018 at 13:13

1 Answer 1

1

You don't have to change anything in this /etc/php/5.6/fpm/php.ini. You can put error_reporting(0) at the top of your application/file.

<?php
// Turn off error reporting
error_reporting(0);
Sign up to request clarification or add additional context in comments.

3 Comments

When I add error_reporting(0) to the script, errors are displayed
Please attach the screenshot of the error page and also your code where you placed error_reporting(0)
Turning off error_reporting is a really bad idea in pretty much any situation.

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.