Announcement

Collapse
No announcement yet.

Php 8

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Php 8

    I was trying to update to PHP 8 on my Kubuntu 20.10 desktop. I followed instructions I found at https://thishosting.rocks/install-php-on-ubuntu/ to use ppa:ondrej/php and everything appeared to install correctly. The command line version of PHP 8 works. But web pages running through apache were still showing PHP 7.4, even though libapache2-mod-php8.0 was installed.

    To try to fix the problem, I ran sudo a2enmod php8.0 -- that command had fixed PHP version config problems before. But this time, running it completely broke apache so that every page is ERR_CONNECTION_REFUSED. Turns out apache isn't even launching anymore. I would try to edit the apache configuration files... except I can't seem to find any relevant files. /etc/apache2/apache2.conf doesn't have anything about PHP in it. So where can I go from here? Anyone have any idea what files a2enmod alters?

    Here's the output when I try to start apache and run the suggested commands for details:

    Code:
    pgk@pgk-desktop:~$ sudo /etc/init.d/apache2 start
    Starting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code.
    See "systemctl status apache2.service" and "journalctl -xe" for details.
    failed!
    
    pgk@pgk-desktop:~$ sudo systemctl status apache2.service
    ● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2021-01-01 13:48:53 PST; 1min 40s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 6373 ExecStart=/usr/sbin/apachectl start (code=exited, status=139)
    
    Jan 01 13:48:53 pgk-desktop systemd[1]: Starting The Apache HTTP Server...
    Jan 01 13:48:53 pgk-desktop apachectl[6376]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'Se>
    Jan 01 13:48:53 pgk-desktop apachectl[6373]: Segmentation fault (core dumped)
    Jan 01 13:48:53 pgk-desktop apachectl[6373]: Action 'start' failed.
    Jan 01 13:48:53 pgk-desktop apachectl[6373]: The Apache error log may have more information.
    Jan 01 13:48:53 pgk-desktop systemd[1]: apache2.service: Control process exited, code=exited, status=139/n/a
    Jan 01 13:48:53 pgk-desktop systemd[1]: apache2.service: Failed with result 'exit-code'.
    Jan 01 13:48:53 pgk-desktop systemd[1]: Failed to start The Apache HTTP Server.
    
    pgk@pgk-desktop:~$ sudo journalctl -xe
    ░░ Support: http://www.ubuntu.com/support
    ░░ 
    ░░ A start job for unit NetworkManager-dispatcher.service has begun execution.
    ░░ 
    ░░ The job identifier is 332646.
    Jan 02 11:37:14 pgk-desktop dbus-daemon[543]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
    Jan 02 11:37:14 pgk-desktop systemd[1]: Started Network Manager Script Dispatcher Service.
    ░░ Subject: A start job for unit NetworkManager-dispatcher.service has finished successfully
    ░░ Defined-By: systemd
    ░░ Support: http://www.ubuntu.com/support
    ░░ 
    ░░ A start job for unit NetworkManager-dispatcher.service has finished successfully.
    ░░ 
    ░░ The job identifier is 332646.
    Jan 02 11:37:23 pgk-desktop sudo[44742]:      pgk : TTY=pts/1 ; PWD=/home/pgk ; USER=root ; COMMAND=/bin/journalctl -xe
    Jan 02 11:37:23 pgk-desktop sudo[44742]: pam_unix(sudo:session): session opened for user root by pgk(uid=0)
    Jan 02 11:37:24 pgk-desktop systemd[1]: NetworkManager-dispatcher.service: Succeeded.
    ░░ Subject: Unit succeeded
    ░░ Defined-By: systemd
    ░░ Support: http://www.ubuntu.com/support
    ░░ 
    ░░ The unit NetworkManager-dispatcher.service has successfully entered the 'dead' state.
    I could try removing the PPA and completely uninstalling all PHP-related packages and then reinstalling in hopes of getting PHP 7.4 back, I suppose, but I want 8.0.

    Additional info: /var/log/apache2/error.log is empty.
    Last edited by Hoth; Jan 02, 2021, 03:36 PM. Reason: checked error log

    #2
    Your situation is classical.
    My first question is: did you make a backup of your system before you tried this?
    If you did then you can avoid wasting a lot of time and just roll back.
    If you didn't make a backup then that is a procedure you should begin to do daily, or at least just before you do any changes like what you tried to do.

    So, from this state you can purge php and apache and then "sudo apt autoremove" to remove orphaned dependencies and "sudo apt-get clean" to clean the apt cache. Then, power down and power back up. Then re-install apache and php 7.4 from the repository. That *should* get you back to where you were before you attempted to upgrade php to 8.0. Then make a backup in case you need to recover again.

    What you use to make a backup depends on what FS you are using. IF EXT4 then TimeShift (which is in the repository) will use rsync to make backups. IF you are using BTRFS then TimeShift can make the BTRFS snapshots and roll back easily to any pre-existing snapshot, or you can do the snapshotting and rolling back manually.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      Nuking the system to restore a backup every time there's an error seems a rather odd way of doing things, and prevents learning. Admittedly I ought to make external backups of flies more often, and I'll have a look at TimeShift.

      I was able to fix the problem by doing a complete removal of libapache2-mod-php 7.4 and 8.0 along with apache2, and then reinstalling only the 8.0 version. Apparently that caused new correct configuration files to be written. I'd swear there used to be a configuration file for apache that specified the PHP version so it'd be nice to know where that is now if anyone knows... but perhaps apache has changed and doesn't configure in that way anymore.

      Comment


        #4
        Of help maybe: https://ubuntu.com/server/docs/web-servers-apache
        Windows no longer obstructs my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          Originally posted by Hoth View Post
          Nuking the system to restore a backup every time there's an error seems a rather odd way of doing things
          Using the terms "nuke" and "restore a backup", I suspect you don't appreciate how simple and quick reverting to a snapshot is. And on a COW fs the updated system is still there, one can boot to either if you want to. A snapshot is not a backup; a drive failure or fs corruption and you need a real backup.

          Originally posted by Hoth View Post
          and prevents learning.
          Yes, I have that attitude, and persist with problematic situations when abandoning them would save time.
          Regards, John Little

          Comment


            #6
            Originally posted by jlittle View Post
            Using the terms "nuke" and "restore a backup", I suspect you don't appreciate how simple and quick reverting to a snapshot is. And on a COW fs the updated system is still there, one can boot to either if you want to. A snapshot is not a backup; a drive failure or fs corruption and you need a real backup.



            Yes, I have that attitude, and persist with problematic situations when abandoning them would save time.
            I have an addition SDD and a spinner installed, besides the SSD my Kubuntu 20.04 is residing on. To make a daily incremental backup I issue
            Code:
            sudo /make_snapshot.sh
            It creates a labeled snapshot on the primary drive and then makes an incremental snapshot on the 2nd SSD. Then it deletes the oldest snapshot on my system and the oldest snapshot on the 2nd SSD. Then it umounts the 2nd SSD and the /mnt of the primary BTRFS <ROOT_FS>, and returns to the prompt. It usually takes only 30 seconds to a minute, depending on how many changes I made from the previous day. Here is the script that I use:
            Code:
            ********************************
            #!/bin/bash
            #
            # script to create backup snapshots to /mnt/snapshots and a differential backup to /backup
            # To be run as root from /
            #
            echo "Mounting drives"
            eval "mount /dev/disk/by-uuid/ce2b5741-c01e-4b3d-b6ba-401ad7f7fcdf /mnt"
            eval "mount /dev/disk/by-uuid/e84e2cdf-d635-41c5-9f6f-1d0235322f48 /backup"
            
            NOW=$(date +%Y%m%d%H%M)
            echo "Making today's snapshot"
            MKSNAP='btrfs su snapshot -r /mnt/@ /mnt/snapshots/@'$NOW
            eval $MKSNAP
            eval 'sync'
            eval 'sync'
            
            echo "Finding previous snapshot as parent "
            PREVSNAP=""
            list=($(ls /mnt/snapshots/))
            PREVSNAP=${list[-2]}
            NOW=${list[-1]}
            echo "Attempting incremental backup"
            if [[ -s "/mnt/snapshots/"$PREVSNAP ]]; 
            then
                MKINC='btrfs send -p /mnt/snapshots/'$PREVSNAP
                MKINC=$MKINC' /mnt/snapshots/'$NOW
                MKINC=$MKINC' | btrfs receive /backup'
                echo $MKINC
                eval $MKINC
                eval 'sync'
                eval 'sync'
                eval "sync"
                DELSNAP='btrfs subvol delete -C /mnt/snapshots/'${list[0]}
                eval $DELSNAP
                eval 'sync'
                eval 'sync'
                eval 'sync'
                list=''
                list=($(ls /backup))
                DELSNAP='btrfs subvol delete -C /backup/'${list[0]}
                eval $DELSNAP
                eval 'sync'
                eval 'sync'
                eval 'sync'
                echo "Snapshots completed, oldest snapshots deleted"
                eval 'umount /backup'
                eval 'umount /mnt'
                echo "Drives unmounted"
            else
                echo 'Incremental backup failed using '$PREVSNAP' and '$NOW
                echo 'Drives still mounted, ready to clean up'
            fi
            
            *******************************
            Since I've combined @ and @home into @ I need snapshot only @.
            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment

            Working...
            X