Dianne Siebold Dianne Siebold - 3 months ago 13
Apache Configuration Question

Opening PHP File in Apache 2.4.7 Returns Blank Page and No Errors

I have installed Apache 2.4.7 and PHP 5 on a box running Ubuntu 14.04. I'm able to open FF and browse to

http://<ip_address>/index.html
and it shows me the Apache2 default page. This
index.php
file is located under
/var/www/html/
and all is good there.

Following the directions from this site, I created
/var/www/html/info.php
to test out PHP. That file contains

<? php phpinfo(); ?>


When I open FF and navigate to
http://<ip_address>/info.php
, I get a blank screen and no errors in
/var/log/apache2/error.log
.

After much Googling, I'm stumped as to why the HTML file displays but the PHP one doesn't. Is there somewhere I can check for PHP errors? The
/etc/apache2/mods-enabled/dir.conf
contains index.php. Also, I modified the
/etc/php5/apache2/php.ini
and set
log_errors = On
. I see no errors in syslog.

The permissions to the
/var/www/html
/ directory are:

drwxrwxr-x 2 www-data www-data 4096 Jun 16 13:22


The permissions to the files in that directory are:

-rwxrwxr-x 1 www-data www-data 11510 Jun 15 11:52 index.html
-rwxrwxr-x 1 www-data www-data 21 Jun 16 10:09 info.php


Thanks in advance for any help!

Answer

it should be <?php and not <? php... <-- notice the space

Fix your PHP tag and see if you have any errors, I will be more than happy to assist.

you can also add these lines just below you <?php line. which will turn on displaying errors and set error reporting to report ALL errors. This only has to be done if the global PHP configuration is turning off error reporting or the displaying of errors, in your case I would suggest trying those lines to see if any errors display.

error_reporting(E_ALL);
ini_set('display_errors', 'On');