Question

How to enable latest PHP on my DO? (Ubuntu 18.04 / Apache / MySQL)

Posted March 22, 2021 621 views
Joomla

Hey,
please advise me, I installed PHP 7.4 via a terminal, but Joomla still reports that I have 7.2 and I don’t know where to “enable it”?
Many thanks for the advice :-)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

If you are using mod PHP, then you can do that with the following:

First disable PHP 7.2:

sudo a2dismod php7.2

Then enable PHP 7.4:

sudo a2enmod php7.4

Finally restart Apache.

Let me know how it goes!
Regards,
Bobby

  • Thx for quick answer. I did, but joomla admin and websites doesnt work (white screen with error). I also checked dir.conf and looks ok (if I have index.php). Dont know what else? Please, can you advice? Thank you

    • Hi there,

      Did you get any errors when running the commands?

      I could suggest checking if the module is enabled with the following command:

      apachectl -M | grep php
      

      If the PHP module is not present you can install it with:

      sudo apt install libapache2-mod-php7.4 libapache2-mod-php
      

      Also I could suggest running a config test with the following command:

      sudo apachectl -t
      

      Regards,
      Bobby

      • Hi Bobby,
        thank you, but no issues when I installed newer PHP. Then I did exactly that, what you wrote - but same problem (error) no changes. And now terminal show me this:

        root@GarantDesign:~# apachectl -M | grep php
        ** php**7_module (shared)
        root@GarantDesign:~#

        Unfortunately, I really dont know whats wrong… :-( Please, any idea?

        • Hi there,

          Do you get any errors when running this command:

          sudo apachectl -t
          

          Also did you restart Apache after enabling the new module?

          Regards,
          Bobby

          • Yes, of course. And: sudo apachectl -t (syntax OK)

          • Hello,

            This is very interesting, can you run the following command and share the output here:

            sudo ls -l /etc/apache2/mods-enabled/
            

            This will list all of the enabled modules.

            Regards,
            Bobby

          • root@GarantDesign:~# sudo ls -l /etc/apache2/mods-enabled/
            total 0
            lrwxrwxrwx 1 root root 36 Jun 11  2019 access_compat.load -> ../mods-available/access_compat.load
            lrwxrwxrwx 1 root root 28 Jun 11  2019 alias.conf -> ../mods-available/alias.conf
            lrwxrwxrwx 1 root root 28 Jun 11  2019 alias.load -> ../mods-available/alias.load
            lrwxrwxrwx 1 root root 33 Jun 11  2019 auth_basic.load -> ../mods-available/auth_basic.load
            lrwxrwxrwx 1 root root 33 Jun 11  2019 authn_core.load -> ../mods-available/authn_core.load
            lrwxrwxrwx 1 root root 33 Jun 11  2019 authn_file.load -> ../mods-available/authn_file.load
            lrwxrwxrwx 1 root root 33 Jun 11  2019 authz_core.load -> ../mods-available/authz_core.load
            lrwxrwxrwx 1 root root 33 Jun 11  2019 authz_host.load -> ../mods-available/authz_host.load
            lrwxrwxrwx 1 root root 33 Jun 11  2019 authz_user.load -> ../mods-available/authz_user.load
            lrwxrwxrwx 1 root root 32 Jun 11  2019 autoindex.conf -> ../mods-available/autoindex.conf
            lrwxrwxrwx 1 root root 32 Jun 11  2019 autoindex.load -> ../mods-available/autoindex.load
            lrwxrwxrwx 1 root root 30 Jun 11  2019 deflate.conf -> ../mods-available/deflate.conf
            lrwxrwxrwx 1 root root 30 Jun 11  2019 deflate.load -> ../mods-available/deflate.load
            lrwxrwxrwx 1 root root 26 Jun 11  2019 dir.conf -> ../mods-available/dir.conf
            lrwxrwxrwx 1 root root 26 Jun 11  2019 dir.load -> ../mods-available/dir.load
            lrwxrwxrwx 1 root root 26 Jun 11  2019 env.load -> ../mods-available/env.load
            lrwxrwxrwx 1 root root 29 Jun 11  2019 filter.load -> ../mods-available/filter.load
            lrwxrwxrwx 1 root root 30 Jul 15  2019 headers.load -> ../mods-available/headers.load
            lrwxrwxrwx 1 root root 28 Jul 15  2019 http2.load -> ../mods-available/http2.load
            lrwxrwxrwx 1 root root 27 Jun 11  2019 mime.conf -> ../mods-available/mime.conf
            lrwxrwxrwx 1 root root 27 Jun 11  2019 mime.load -> ../mods-available/mime.load
            lrwxrwxrwx 1 root root 34 Jun 11  2019 mpm_prefork.conf -> ../mods-available/mpm_prefork.conf
            lrwxrwxrwx 1 root root 34 Jun 11  2019 mpm_prefork.load -> ../mods-available/mpm_prefork.load
            lrwxrwxrwx 1 root root 34 Jun 11  2019 negotiation.conf -> ../mods-available/negotiation.conf
            lrwxrwxrwx 1 root root 34 Jun 11  2019 negotiation.load -> ../mods-available/negotiation.load
            lrwxrwxrwx 1 root root 29 Mar 23 12:47 php7.4.conf -> ../mods-available/php7.4.conf
            lrwxrwxrwx 1 root root 29 Mar 23 12:47 php7.4.load -> ../mods-available/php7.4.load
            lrwxrwxrwx 1 root root 33 Jun 11  2019 reqtimeout.conf -> ../mods-available/reqtimeout.conf
            lrwxrwxrwx 1 root root 33 Jun 11  2019 reqtimeout.load -> ../mods-available/reqtimeout.load
            lrwxrwxrwx 1 root root 30 Jun 11  2019 rewrite.load -> ../mods-available/rewrite.load
            lrwxrwxrwx 1 root root 31 Jun 11  2019 setenvif.conf -> ../mods-available/setenvif.conf
            lrwxrwxrwx 1 root root 31 Jun 11  2019 setenvif.load -> ../mods-available/setenvif.load
            lrwxrwxrwx 1 root root 36 Jul 15  2019 socache_shmcb.load -> ../mods-available/socache_shmcb.load
            lrwxrwxrwx 1 root root 26 Jul 15  2019 ssl.conf -> ../mods-available/ssl.conf
            lrwxrwxrwx 1 root root 26 Jul 15  2019 ssl.load -> ../mods-available/ssl.load
            lrwxrwxrwx 1 root root 29 Jun 11  2019 status.conf -> ../mods-available/status.conf
            lrwxrwxrwx 1 root root 29 Jun 11  2019 status.load -> ../mods-available/status.load
            root@GarantDesign:~# 
            
            edited by bobbyiliev
          • Hey,

            Thanks for that! It looks like that php7.4 is already enabled.

            What I could suggest is adding an info.php file and visiting it via your browser to make sure that it works:

            <?php
            
            phpinfo();
            
            ?>
            

            Let me know how it goes!
            Regards,
            Bobby

          • Hi Bobby,
            I have phpinfo.php (same code) and i tried via my browser (Safari / Chrome also) and same problem.... :-/. Websites still doesnt work a same white screen.... Bobby pls, whats wrong, I just did upgrade PHP… nothing more....

          • Hello,

            Do you see any errors in your error log?

            tail -100 /var/log/apache2/error.log
            

            What is the exact output that you get when you visit the PHP info file?

            Do you see any errors in the web console of your browser?

            Regards,
            Bobby