Ubuntu: Apache2 & PHP showing blank page



Question:

I've tried to install PHP and Apache2, however when I access the file, it just shows a blank page.

I've installed the packages php, apache2, php-mysql (and some others)

I've already tried pretty much everything that I could find on the Internet.

I'm sorry if I'm not providing enough info, I will give any info that I can.


Solution:1

Sorry if this is an anwser instead of comment but because of reputation I can't comment.

A black page could be because of a php fatal error (or could be an php non-fatal error if no content was still send to the browser) when display_errors is set to off in the php.ini. Look at the php log file to get back the error log

It could be also because the php file content is send as raw text to your navigator, look at the "html source code" from your browser to make sure you don't see php code. If you do the php module isn't setup properly with apache.


Solution:2

Try the following:

  1. Install php for Apache with sudo apt-get install libapache2-mod-php
  2. Place code to the /var/www/html/phpinfo.php:

    <?php  phpinfo();  ?>  
  3. Navigate web-browser to http://localhost/phpinfo.php.

These steps will help to check that PHP is working normally.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »