• exitoffroad

    (@exitoffroad)


    After several days of trying to figure out why my site health was showing my server as PHP 7.4.33, yet my hosting server was running 8.3.6, and hours on chat with my host Bluehost (they were useless in helping), I finally figured out the issue with the help of ChatGPT.

    My regular htaccess file in my public.html was set correctly to use PHP 8.3. My host was insistent that my server was using 8.3, which it actually was. WordPress was showing that I’m using 7.4.33, no matter what updates we did on the server side. 3 different people could not figure out what I was trying to show them.

    I found this other thread here: https://ww.wp.xz.cn/support/topic/wordpress-thinks-my-php-is-older-version/page/2/ and also https://ww.wp.xz.cn/support/topic/wordpress-says-i-need-to-update-my-php-but-its-at-8-1/

    I wish I could open them and post this reply, but I can’t. He figured out it was a plugin issue, but I just found this out:

    There’s an additional htaccess file under public.html > wp-admin

    This was overriding the other htaccess file one level below. That one I just found was still pointed at PHP 7, so I updated the file to 8.3 and it’s all working correctly on my site now. No idea why it didn’t update itself, but maybe WordPress needs to do something about that? Like check the server config and update WordPress when it does an update to match the PHP version? Maybe a different plugin is somehow causing wordpress to use an old version of PHP?

    Hope this helps others in the future.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @exitoffroad

    I hope you are doing well and thank you for sharing that.

    I checked the WordPress wp_check_php_version() function and it uses the PHP_VERSION https://www.php.net/manual/en/reserved.constants.php#constant.php-version so if the htaccess in wp-admin is messing with the PHP it would make sense the WordPress sees the wrong version, as the native constant would be returning the PHP for that directory.

    As for improvement, to be honest I don’t see it as a bug but that would be my view, you may have a look at https://make.ww.wp.xz.cn/core/handbook/testing/reporting-bugs/ in case you would like to report that.

    Best Regards
    Patrick Freitas

    Moderator threadi

    (@threadi)

    I would also like to add: WordPress itself does not set .htaccess in the wp-admin directory. It must have been put there by a plugin of yours or by your hoster.

    Adding some more info here as to possible causes of this. I encountered this issue after updating PHP from 8.0 to 8.3 on Ubuntu, but no additional .htaccess files were present. WordPress was still insisting that it was running PHP 8.0. In my case, apache was running a different PHP version than Ubuntu. The solution in my case was to install the correct module for apache:

    sudoapt install libapache2-mod-php8.3

    sudo a2enmod php8.3

    sudo systemctl restart apache2

    Hope that’s useful info in case someone else encounters the same issue.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WordPress reading old PHP version, server running current version’ is closed to new replies.