Apache 2.4 Virtualhost Blank Screen

5,268

if you get blank pages on loading php pages, set display_errors = On in /path-to-your/php.ini and start apache again (e.g.: sudo service apache24 onerestart). This way instead of a blank page, the missing extension(s) will be shown on the page. Chances are that it is commented out or missing in /path-to-your/php/extensions.ini (read on a FreeBSD forum, tip from soulreaver1)

Share:
5,268

Related videos on Youtube

skubik
Author by

skubik

Updated on September 18, 2022

Comments

  • skubik
    skubik over 1 year

    I've recently moved a PHP project I'm working on to a VM running Apache 2.4.9 from a physical box running Apache 2.2.11. I have setup a VirtualHost for the project similar to what I had on the 2.2 box. I know there are differences between 2.2 and 2.4, which I'm pretty sure I've addressed in my 2.4 Virtualhost config, but I seem to be missing something.

    When I point my browser to the URL of my VM for my project VirtualHost (http://project.dev.lan, in this case), all I get it a blank (white) screen. I have another VirtualHost setup for the default Document root and it seems to be working just fine; the page comes up as expected.

    Can someone help steer me in the right direction?

    apachectl -S returns:

    VirtualHost configuration:
    *:80                   is a NameVirtualHost
             default server localhost (/usr/local/etc/apache2/extra/httpd-vhosts.conf:40)
             port 80 namevhost localhost (/usr/local/etc/apache2/extra/httpd-vhosts.conf:40)
                     alias 192.168.0.130
             port 80 namevhost project.dev.lan (/usr/local/etc/apache2/extra/httpd-vhosts.conf:46)
                     alias project.dev.vm
    ServerRoot: "/usr/local/apache2"
    Main DocumentRoot: "/data/www/apache2:80"
    Main ErrorLog: "/var/log/apache2/error_log"
    Mutex rewrite-map: using_defaults
    Mutex proxy: using_defaults
    Mutex default: dir="/usr/local/apache2/logs/" mechanism=default 
    Mutex mpm-accept: using_defaults
    Mutex proxy-balancer-shm: using_defaults
    PidFile: "/usr/local/apache2/logs/httpd.pid"
    Define: DUMP_VHOSTS
    Define: DUMP_RUN_CFG
    User: name="apache2" id=2000
    Group: name="www" id=103
    

    My VirtualHost file contains:

    <VirtualHost *:80>
            ServerName      localhost
            ServerAlias     192.168.0.130
            DocumentRoot    /data/www/apache2:80
    </VirtualHost>
    
    <VirtualHost *:80>
            ServerName      project.dev.lan
            ServerAlias     project.dev.vm
            DocumentRoot    /data/www/project/SRC
            DirectoryIndex  index.php index.html
            ServerAdmin     [email protected]
            ErrorLog        /var/log/apache2/project.dev.lan-error_log
            CustomLog       /var/log/apache2/project.dev.lan-access_log common
    
            <Directory "/data/www/project/SRC">
                    Options         +Indexes +Multiviews +FollowSymLinks
                    AllowOverride   All
                    Require         all granted
            </Directory>
    </VirtualHost>
    

    I can post my httpd.conf if necessary, though I haven't changed much from the default beyond ensuring that my extra/httpd-vhosts.conf file has been included.

    Can anyone shed some light on what I'm missing?

    Thanks

    • ravi yarlagadda
      ravi yarlagadda almost 10 years
      Anything in Apache's error log?
    • skubik
      skubik almost 10 years
      No, nothing that would indicate a problem.
    • ravi yarlagadda
      ravi yarlagadda almost 10 years
      What HTTP headers are you getting on the blank page response?
    • skubik
      skubik almost 10 years
      HTTP/1.1 200 OK Date: Mon, 16 Jun 2014 18:26:44 GMT Server: Apache/2.4.9 (Unix) PHP/5.4.29 x-powered-by: PHP/5.4.29 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 0 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html
    • skubik
      skubik almost 10 years
      Just grabbed it from Firebug. Sorry for the lack of formatting. I suppose it's possible it's a PHP thing, but I'd assume I'd be getting something in the logs if it was. Usually when I get a blank screen like this, it's a syntax error, but again, it usually says something in my logs.
    • ravi yarlagadda
      ravi yarlagadda almost 10 years
      Looks like the PHP hander is generating the content, so that's where we should be looking. Do you know what the config looks like for your PHP handling?
    • skubik
      skubik almost 10 years
      Turns out I didn't have a php.ini set that Apache was able to load, so I copied the php.ini-development file from the PHP source into the appropriate spot and restarted Apache. phpinfo() now shows that it is loading php.ini but there's no change to the problem. I am, however, getting PHP errors in my Apache error log files, though it seems to be all PHP Warnings, Notices and 'Strict Standards', but nothing that would appear to cause my PHP scripts to fail like they are. I did add another PHP file with a simple echo and it worked fine on that virtualhost. What else should I look for?
    • telcoM
      telcoM over 6 years
      Is the current /data/www/project/SRC/index.* file OK? I might try temporarily replacing it with something simpler and verifying that it works. Then replacing it with something that calls phpinfo() and verifying that the PHP environment within the virtual host is as expected.