apache PHP Development Virtual Host


This is an example on how to control PHP error logging in a virtual host site for development and debugging. Assumptions

  • The PHP module has been installed.
  • Development environment is not for production.
<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 2147483647
    php_value error_log /var/www/domains/example.com/php.error.log

Note: The Virtual Host configuration is for development only because the display_errors is enabled and you do not want that in production.