• Hi guys

    Wordpress appears to be using PHP7.1 despite 7.3 being installed.

    Seems to be a lot of questions about this problem but no cohesive way to deal with it…

    I have just setup a new server on AWS (Ubuntu 18). It came pre packaged with PHP, mysql, and WordPress. I ran apt upgrade and this seems to have installed PHP7.3.

    php -v shows “PHP 7.3.16-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 20 2020 13:51:46) ( NTS )”. But for some reason I get a warning in wordpress because it seems to be using PHP 7.1.

    Is there a clear set of instructions to follow which I can use to switch wordpress over to use PHP7.3?

    Thanks

Viewing 13 replies - 1 through 13 (of 13 total)
  • Did you upgrade PHP? Or a clean install of 7.3?

    Thread Starter wbuchanan

    (@wbuchanan)

    I just upgraded using apt

    Ok. The same thing happened to me, but with Vagrant/Ubuntu

    Check if the previous version is still there. When I upgraded, it just added 7.3 next to 7.1

    Thread Starter wbuchanan

    (@wbuchanan)

    Hi a2hostingrj…

    Yes all the versions seem to still be on the server. In fact it appears to have 7.0 up to 7.4.

    Any thoughts on how to make wordpress use the right one?

    Thanks

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Look in the .htaccess file for your site. It may specify the PHP version. If not there, look for a php.ini file in the site root.

    Thread Starter wbuchanan

    (@wbuchanan)

    Thanks for the reply Steve.

    I have a .htaccess file but nothing related to php in there. I can’t seem to see a php.ini file (i’m looking in the wordpress root folder).

    Any thoughts on where else to look?

    Thanks

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Check your php-fpm configuration files and apache configuration files. Your configs may be pointing to version-specific PHP directories.

    Note that this is a Linux sysadmin problem, not a WordPress problem. WordPress only sees what your configurations supply. You should also be asking about this on AWS or Ubuntu support forums.

    Thread Starter wbuchanan

    (@wbuchanan)

    Thanks Steve

    I’m still new to this. It is frustrating that WordPress is telling me what the actual problem is, but doesn’t have an easy way to fix it.

    The apache configuration seems to have php7.3-fpm.conf in the conf-enabled folder.

    I will maybe sign up to those other forums and see if anyone on there has any ideas.

    Thanks

    It is frustrating that WordPress is telling me what the actual problem is, but doesn’t have an easy way to fix it.

    It is not WordPress, it is your server configuration/setup. I suggest to talk with your hosting tech support

    I have a .htaccess file but nothing related to php in there.

    Here’s an example on how to set which version of PHP to use:

    AddHandler application/x-httpd-php71 .php

    (It has to be at the top of the .htaccess)

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    That applies, FWIW, only if you’re using mod_php, not if you’re using PHP-FPM.

    Dion

    (@diondesigns)

    Did you restart Apache after upgrading PHP?

    Thread Starter wbuchanan

    (@wbuchanan)

    Thanks for the infor guys.

    @a2hostingrj I tried that but it didn’t make any difference. Must be as @sterndata advised not for this version of PHP.

    @diondesigns yes I rebooted the server several times throughout this process!

    Thread Starter wbuchanan

    (@wbuchanan)

    I managed to find some instructions which worked. Posting below for future reference:

    How to switch PHP versions
    Example: Applies to ALL versions [PHP 7.1, PHP 7.2, PHP 7.3]
    To Switch to php 7.0 from php 7.1:
    – Disable FPM Service for PHP 7.1
    sudo service php7.1-fpm stop
    – Since we want 7.0 as the default, Disable 7.1 FPM Service on Startup
    sudo systemctl disable php7.1-fpm
    – Double-Check, but these should already be Disabled
    sudo a2dismod php7.1
    sudo a2dismod php7.0
    – Verify Apache Config for 7.0 is Active One
    sudo a2disconf php7.1-fpm.conf
    sudo service apache2 restart
    sudo a2enconf php7.0-fpm.conf
    sudo service apache2 restart
    – Restart PHP 7.0 FPM Service and Enable on Startup
    sudo systemctl enable php7.0-fpm
    sudo service php7.0-fpm restart
    sudo service apache2 restart
    sudo update-alternatives –set php /usr/bin/php7.0
    – Verify PHP 7.0 with Opcache
    php -version
    – Double-Checking Services Running
    systemctl status php7.0-fpm
    systemctl status apache2

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Running an older version of PHP’ is closed to new replies.