Search code examples
phpapachefpm

I have php errors when display_errors is off


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


Solution

  • 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);