PHP Code Showing Up in Browser

I'm setting up Gibbon for the first time and I don't have much experience with PHP and configuring Linux for it. I am using the Ubuntu installation page as a guide, but I should admit I am trying to use a configuration tool (Ansible to help me with it).

I've shown below the versions of Apache, php, and mysql I am running. I have mod_rewrite enabled (I think)!

I read that the short_open_tag configuration is sometimes the problem here, so I tried to show below that that is set to On.

Any suggestions?

Thanks,
Nick

-------


vagrant@vagrant:/etc/apache2/mods-enabled$ apache2 -v
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2019-09-16T12:58:48
vagrant@vagrant:/etc/apache2/mods-enabled$ php -v
PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.19-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
vagrant@vagrant:/etc/apache2/mods-enabled$ cat /etc/php/7.2/apache2/php.ini | grep short
short_open_tag = On
vagrant@vagrant:/etc/apache2/mods-enabled$ ls /etc/apache2/mods-enabled/ | grep write
rewrite.load
vagrant@vagrant:/etc/apache2/mods-enabled$ a2enmod rewrite
Module rewrite already enabled
vagrant@vagrant:/etc/apache2/mods-enabled$ sudo a2enmod rewrite
Module rewrite already enabled
vagrant@vagrant:/etc/apache2/mods-enabled$ ls /etc/apache2/mods-enabled/ | grep write
rewrite.load
vagrant@vagrant:/etc/apache2/mods-enabled$ sudo mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| gibbon |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)

mysql>

Comments

  • A couple of times I thought I spotted my error -- a missing packages, incorrect permissions, but I fixed those errors and still have the same result.

    To be clear, what I mean is that my browser is showing the index PHP code instead of executing or interpreting it. Like this:


    . */ use Gibbon\Domain\System\ModuleGateway; use Gibbon\Domain\DataUpdater\DataUpdaterGateway; use Gibbon\Domain\Students\StudentGateway; use Gibbon\Domain\User\UserGateway; /** * BOOTSTRAP * * The bootstrapping process creates the essential variables and services for * Gibbon. These are required for all scripts: page views, CLI and API. */ // Gibbon system...

    Permissions

    Here are the permissions on the folder:

    vagrant@vagrant:/var/www$ ls -la
    total 20
    drwxr-xr-x 5 root root 4096 Sep 23 12:07 .
    drwxr-xr-x 12 root root 4096 Sep 23 08:30 ..
    drwxr-xr-x 15 www-data www-data 4096 Aug 20 04:04 gibbon.local


    Installed PHP Packages

    Here are my installed PHP packages:

    vagrant@vagrant:/var/www$ apt list --installed | grep php

    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

    php-apcu/bionic,now 5.1.9+4.0.11-1build1 amd64 [installed]
    php-apcu-bc/bionic,now 1.0.3-2ubuntu2 amd64 [installed,automatic]
    php-common/bionic,bionic,now 1:60ubuntu1 all [installed,automatic]
    php-mysql/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
    php-pear/bionic-updates,bionic-updates,bionic-security,bionic-security,now 1:1.10.5+submodules+notgz-1ubuntu1.18.04.1 all [installed,automatic]
    php-sqlite3/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
    php7.2-cli/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-common/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-curl/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-dev/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-fpm/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-gd/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-imap/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-json/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-mbstring/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-mysql/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,automatic]
    php7.2-opcache/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-phpdbg/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,automatic]
    php7.2-readline/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,automatic]
    php7.2-sqlite3/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,automatic]
    php7.2-xml/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    php7.2-zip/bionic-updates,bionic-security,now 7.2.19-0ubuntu0.18.04.2 amd64 [installed]
    pkg-php-tools/bionic,bionic,now 1.35ubuntu1 all [installed,automatic]
  • edited September 2019
    Hi nickp, this is really odd. Generally it either appears all of the time, or none of the time. The PHP short tag issue is something we fixed ages ago, and so it should not be that. If you go into Admin > System Admin > System Check, is there anything there that is showing a red cross? Thanks, Ross.
  • Ross,

    Not sure if I miscommunicated, but it’s an all of the time situation. I’m trying to set it up for the first time. So I have never successfully opened Gibbon in the browser. So your suggestion to go to the Admin menu doesn’t work for me. I think I must have some basic configuration wrong but I can’t figure out what it is.
  • Hi Nick, ah, that makes sense. It feels like PHP is not evening running. Can you create a phpinfo page with the following code in it (and nothing else) and see what happens:

    <?php

    phpinfo();

    ?>

    Thanks,

    Ross
  • Ross,

    I tried that to and it didn't work.

    So, I finally have a solution and am able to see the installer page now.

    I'm a little embarrassed to admit but I was missing libapache2-mod-php

    However, in my defense, I was trying to install the packages listed on the Ubuntu installer page exactly, and this package was missing.

    So maybe this package should be added to that page, would that be okay?

    Nick
  • Hi Nick,

    No embarrassment required: we've all been there, and I bet we'll all be there again some time soon!

    This support page was put together by @jimbo8098, and so I'm keen to get his input here.

    Thanks for taking the time to follow up.

    Hi Jim,

    Sounds like libapache2-mod-php has been left of the install instructions for Ubuntu. Perhaps this is version related. Would you mind taking a look?

    Thanks,

    Ross
Sign In or Register to comment.