Getting blank PHP page over Apache
apache, centos, php
Solution
It's been sometime, but I wanted to come back to this question to update that the issue was with the directory permission setup.
The FPM user I was using didn't have necessary permission to execute the `index.php` file in the web root.
To avoid these issues in the future, I have created an automated bash script that will automatically create and configure webservers in DigitalOcean boxes. Please take a look here https://github.com/akash-mitra/fairy
This script will automatically,
- Installs Nginx
- Create virtual server block for nginx
- Installs PHP, PHP APC, PHP Curl etc.
- Supports PHP Fast Process Manager (php-fpm)
- Installs Memcached
- Installs Database (MariaDB / MySQL)
- Optionally Installs PHP Composer and Laravel
- Configures and Strengthens SSH
- Activates Firewall
- Optionally enables SWAP space in DO server and fixes a locale issue
Problem
In a newly setup digitalOcean cloud server (CentOS), I have installed php and Apache. The webserver is running fine: ``` [root@a2m5cent01 httpd]# service httpd status httpd (pid 11232) is running... [root@a2m5cent01 httpd]# php --version | head -1 PHP 5.3.3 (cli) (built: Dec 11 2013 03:29:57) ``` But browser is showing blank pages (white page) if I try to visit any php page. Here is what I have done so far to troubleshoot: - Created a page with following content: `<?php phpinfo(); ?>`. It displays a blank page when viewed from browser. - Just to ensure, apache is pointing to the correct directory, placed a static `.html` page there, and saw it comes out fine in browser, so apache is working and directory is correct. - In `/etc/php.ini`, changed `display_errors` directive to `On`. Still blank page - In Apache config file (`/etc/httpd/conf/httpd.conf`) found this line `Include conf.d/*.conf`. Inside `conf.d` directory, there is a `php.conf` file containing the line: `LoadModule php5_module modules/libphp5.so`. Ensured that this .so file actually exists in this place. - In the same file I have these two lines as well: `AddHandler php5-script .php` and `AddType text/html .php` - Executed the php page from CLI, it works fine - so php is working locally. Then why is it always shows a blank/white page over the browser? What else am I missing? EDIT Based on suggestions from @Nathan, - I checked Apache error log file, could not see any error being reported there. - My `/etc/php.ini` says, php error_log is located as `syslog`. So I checked `/var/log/messages` but could not find any PHP error message - Next I put some normal `HTML` in the php file containing `phpinfo()` call. Interestingly I found that even the normal HTML texts are also not coming. It still produces blank page. - Then I checked Apache `access` log. Surprise! There is no `GET` request for any of the PHP files I tried to load in the browser. But GET request for all the non-php files are there with 200 return code. Apache is not even logging any access request for PHP files. Any idea why would that happen?