Search code examples
phplighttpderror-reportingvirtual-hosts

lighttpd, php, fastcgi - individual virtual host settings for notices warnings and error showing


I am looking for a way to configure the virtual hosts on a lighttpd individually to show or not Errors and Warnings.

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

I like to make it from the virtual hots configuration. Not from the php.ini.

$HTTP["host"] =~ "domain1\.com" {
            server.document-root = "/home/lighttpd/domain1.com/http"
            accesslog.filename   = "/home/lighttpd/domain1.com/logs/access.log"

            php_flag display_errors On ....???

}

If you try the Code above you get the following Errors

root@web:~/lighttpd# /etc/init.d/lighttpd restart
2014-02-05 11:23:54: (configfile.c.932) source: /usr/share/lighttpd/mysql_vhost.py line: 8 pos: 24 parser failed somehow near here: display_errors
2014-02-05 11:23:54: (configfile.c.932) source: /etc/lighttpd/lighttpd.conf line: 32 pos: 1 parser failed somehow near here: (EOL)

is there any other way to talk to PHP from inside lighttpd ? PHP is loaded as a module. It should be one.


Solution

  • Not sure, are looking for something like this

    <VirtualHost *:80>
        ServerName example.com
        DocumentRoot /var/www/domains/example.com/html
        ErrorLog /var/www/domains/example.com/apache.error.log
        CustomLog /var/www/domains/example.com/apache.access.log common
        php_flag log_errors on
        php_flag display_errors on
        php_value error_reporting 30719
        php_value error_log /var/www/domains/example.com/php.error.log
    </VirtualHost>
    

    The reason 30719 is used is below

    All errors and warnings, as supported, except of level E_STRICT prior to PHP 5.4.0. 32767 in PHP 5.4.x, 30719 in PHP 5.3.x, 6143 in PHP 5.2.x, 2047 previously . Read here for this.

    You can use

    php_value error_reporting 2147483647
    

    The above number, according to documentation should enable 'all' errors irrespective of version, if you want a more granular setting, manually OR the values together, or run

    Or see below

    php_value error_reporting 6143 # for all errors notice, warnings, etc
    php_value error_reporting 6135 #show warnings less strict