Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: After upgrade from 16.04 to 18.04 php based applications do not work

  1. #1
    Join Date
    Jul 2009
    Beans
    318

    After upgrade from 16.04 to 18.04 php based applications do not work

    Hello,
    I upgraded the virtual machine from Ubuntu 16.04 to 18.04. I followed this process https://websiteforstudents.com/upgra...s-beta-server/
    After the upgrade when I run any php application, only the php code is displayed in the browser instead of the application running in the browser.

    Please help

  2. #2
    Join Date
    Sep 2011
    Location
    Behind you!
    Beans
    1,169
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    You jumped the gun on doing the upgrade. For a greater chance of success you should always wait for the first point release before doing the in-place upgrade. e.g. 18.04.1 LTS

    However, the in-place upgrade only ensures that the operating system will be upgraded successfully. Any installed apps / libraries beyond the base OS will be hit-or-miss.

    Ubuntu 16.04 used PHP 7.0 but 18.04 uses PHP 7.2 so all the various modules will be named differently.

    At this point, you should probably uninstall Apache/PHP and re-install using the correct names/versions.

    For example:

    Code:
    apt -y install apache2 php7.2 libapache2-mod-php7.2
    That will get Apache and PHP installed so that PHP pages will process correctly.

    You may need to install additional libraries depending on your app's needs...like these as an example:

    Code:
    apt -y install php7.2-curl php7.2-xml php7.2-gd php7.2-mysql php7.2-zip php7.2-intl
    I don't know about how others upgrade their servers but I "never" do an in-place upgrade. I always install a new server, migrate the settings/data over from the old server and make 100% sure everything will work 1st. Then I move the IP to the new server and let it become the new server. Or if I only had the one physical box, I'd make sure everything was running on another machine (like on my PC inside a virtual server), then blow out the old server and install from scratch using the tested/verified procedure I did for the test box. Then migrate the data over from the backup location.

    LHammonds

  3. #3
    Join Date
    Jul 2009
    Beans
    318

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    Hello LHammonds ,
    Thank you for your immediate reply. The plan to chalk out server upgrades is perfect and I do agree to it. I also visited and bookmarked hammondslegacy.com , an excellent site.

    I uninstalled and installed back php and apache2 using the commands in your post but there is no joy. I am afraid I may be stuck with a broken server.

  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    14,587
    Distro
    Kubuntu Development Release

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    Make sure you have the libapache2-mod-php package installed. On 18.04 you also need libapache2-mod-php7.2.

    The quickest and easiest way to get a complete Apache+PHP installation, with MySQL thrown in on the side, is to run

    Code:
    sudo apt update
    sudo apt install lamp-server^
    The tilde "^" must be included.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Jul 2009
    Beans
    318

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    Quote Originally Posted by SeijiSensei View Post
    Make sure you have the libapache2-mod-php package installed. On 18.04 you also need libapache2-mod-php7.2.

    The quickest and easiest way to get a complete Apache+PHP installation, with MySQL thrown in on the side, is to run

    Code:
    sudo apt update
    sudo apt install lamp-server^
    The tilde "^" must be included.
    I have many applications installed on the server and each has a mysql password along with mysql data. I am not sure if I install mysql afresh , all my database will be intact.
    The problem is with apache and php hence I would like to try solving it at that level.

  6. #6
    Join Date
    Jul 2009
    Beans
    318

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    I tried out many suggestions on the web and I have been able to run php scripts in the document root /var/www/html But I am not able to run the php script in any subfolders of the document root.

    Any help is appreciated.

  7. #7
    Join Date
    Nov 2009
    Beans
    Hidden!
    Distro
    Kubuntu 18.04 Bionic Beaver

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    Quote Originally Posted by deepakdeshp View Post
    I have many applications installed on the server and each has a mysql password along with mysql data. I am not sure if I install mysql afresh , all my database will be intact.
    well you have backups made anyway, so why does it matter?
    Easy to understand Ubuntu manual with lots of pics: http://ubuntu-manual.org/
    Do i need antivirus/firewall in linux?
    Disk backup (works on newer PC): Clonezilla

  8. #8
    Join Date
    Sep 2011
    Location
    Behind you!
    Beans
    1,169
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    Quote Originally Posted by deepakdeshp View Post
    I tried out many suggestions on the web and I have been able to run php scripts in the document root /var/www/html But I am not able to run the php script in any subfolders of the document root.

    Any help is appreciated.
    Well, it sounds like Apache+PHP is working if you can get a single PHP file to run instead of reveal its code. So at this point, you need to trouble-shoot file permissions (is owner set to www-data) and review the .conf files in /etc/apache2/sites-available

    After you look-over those, take a look at the error logs to see what specifically is failing beyond simple file permission/ownership settings and site configuration issues.

    Try not to look at the server and get overwhelmed at all the things that do not work and focus on making very-specific things work...such as just getting PHP working. Make a phpinfo.php file and get it to work and look at the modules that are loaded. Then make a small php file that makes a simple call to a database just to ensure that PHP can connect and talk to the database. Keep working on the basic building blocks and as you solve specific problems, it may clear up many more issues down the line.

    LHammonds
    Last edited by LHammonds; June 11th, 2018 at 04:10 PM.

  9. #9
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    14,587
    Distro
    Kubuntu Development Release

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    Quote Originally Posted by deepakdeshp View Post
    I have many applications installed on the server and each has a mysql password along with mysql data. I am not sure if I install mysql afresh , all my database will be intact.
    You can "dump" the entire contents of MySQL and its databases to text using the "mysqldump" command and its "--all-databases" switch. You can then restore the entire database from that file in case disaster strikes. See https://stackoverflow.com/questions/...es-at-one-time. I run a script on my server that uses this method to back up all my databases and store the result on a remote machine.
    Last edited by SeijiSensei; June 11th, 2018 at 06:39 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  10. #10
    Join Date
    Jun 2018
    Beans
    3

    Re: After upgrade from 16.04 to 18.04 php based applications do not work

    I ran into the same problem. The solution is to a2enmod (enable module) for PHP 7.2. The old "enable module for PHP 7.0" won't do anything for you.

    Essentially, the problem is that the PHP 7.2 module is not enabled for Apache and PHP 7.0 isn't present to serve the content any longer.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •