2

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!

2 Answers 2

2

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'); 
Sign up to request clarification or add additional context in comments.

1 Comment

Uh, thanks, removing the space did it. Can't believe I did that. :)
2

I had the same issue, here i made a video about it

https://www.youtube.com/watch?v=BAEjql9yrmk

in

/etc/httpd/conf/httpd.conf 

add

AddType application/x-httpd-php .php 

and comment

# php_admin_value engine Off 

if any

hope that helps

1 Comment

Thanks for that tip. I don't have an /etc/httpd/ directory. I believe the latest version of Apache doesn't have a httpd.conf file but instead a group of config files all used by /etc/apache2/apache2.conf. I'll take a look in to those files and see if I can find where that value might go.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.