0

I recently installed Linux Mint 18.3 Mate on a new PC. It all works fine but I am unable to install PHP successfully as part a LAMP set-up (for use via localhost).

I installed LAMP via the terminal with

sudo apt-get install lamp-server^ -y

The Apache test (the "It works!" page) is successful.

The PHP test (a file that simply has <?php phpinfo(); ?> in it), though, produces a blank white page. The file is called "testphp.php" and I attempt to access it at localhost/testphp.php.

I have checked several potential causes of the trouble:

  • The phpinfo test file is in /var/www/html and I confirmed in the etc/apache2/sites-available/000-default.conf file that this directory is the document root.

  • I set display_errors = On in the /etc/php/7.0/apache2/php.ini file, but when I try the phpinfo test page, no errors appear.

  • I checked the /var/log/apache2/access.log file to confirm that the phpinfo test page accesses are recorded by the system. But no errors appear in the /var/log/apache2/error.log file on these access attempts.

  • I confirmed that I have a current libapache2-mod-php by running:

    sudo apt-get install libapache2-mod-php

    The terminal returned the message that it is already the newest version.

  • I confirmed that PHP 7 (7.0.22-0ubuntu0.16.04.1) is running with php -v at the terminal.

What else should I check or do to troubleshoot this problem?

Thank you for your help!

isr
  • 1
  • Does blank page mean HTTP status `500 Internal Server Error`? You can check that with any browser. Did you check PHP error logs as well? Does command-line PHP run? – Álvaro González Dec 15 '17 at 09:16
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Dec 15 '17 at 12:14
  • @Alvaro Gonzalez, the page is entirely blank with no "500 Internal Server Error" message. In my question, I described how I checked the PHP error log (the location I listed is the same as that mentioned in another StackOverflow question thread: [link](https://stackoverflow.com/questions/5127838/where-does-php-store-the-error-log-php5-apache-fastcgi-cpanel)). – isr Dec 15 '17 at 18:23
  • @jww, my question seems to fit the guidelines as it concerns "software tools commonly used by programmers." When I did a web search on my topic, the most relevant and recent threads were on StackOverflow. There are few such posts on the other sites you mentioned. Even the "failed-installation" tag has been used here on hundreds of questions. – isr Dec 15 '17 at 18:27
  • @ÁlvaroGonzález, I haven't run PHP from the command line before. How would I do it? – isr Dec 15 '17 at 18:45
  • You only mention `/var/log/apache2/access.log` :-?. As about command-line, just type `php` in the terminal and hit enter (or, even better, `php -v`). Even though command-line settings do not need to be the same as Apache settings, it sometimes reveals installation problems that dump error messages, such as missing libraries. – Álvaro González Dec 16 '17 at 08:33
  • @ÁlvaroGonzález, as I mentioned in my question, I already ran `php -v` and showed a seemingly normal installation. Here is the output: `PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies`. What other logs should I check and where are they located? – isr Dec 16 '17 at 20:20
  • Sorry, I overlooked that. PHP error log location is determined by the [`error_log` directive](http://php.net/manual/en/errorfunc.configuration.php#ini.error-log). – Álvaro González Dec 17 '17 at 08:49
  • @ÁlvaroGonzález, thank you for the further information. The `error_log` directive was commented out in my php.ini. I uncommented it and set a file name for the errors. However, when I attempted to access `localhost/testphp.php`, no error was logged. – isr Dec 18 '17 at 21:14

0 Answers0