• Resolved webdad2000

    (@webdad2000)


    Previously I worked through an issue where my host’s server was running PHP 7.4, but my site was not using it, by editing the .htaccess file. That worked great for a while, but then reverted back.

    Upon closer examination I see the following in my .htaccess, which shows that the AddHandler is rewritten.

    I’ve looked through my php.ini (which appears to show 7.4) and done some searches that reference needing to update Apache to get this fixed.

    Can anyone provide some confirmation or alternatives to how to get WordPress to recognize the php version itself vs my manual edits of the .htaccess file?

    Thanks

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    AddHandler application/x-httpd-ea-php70 .php
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /site/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /site/index.php [L]
    </IfModule>
    
    # END WordPress

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Several points:

    – the directive AddHandler application/x-httpd-ea-php70 .php should not be nested within the BEGIN WORDPRESS >> END WORDPRESS block of code, as it will be overwritten by WordPress.
    – that current directive looks like setting PHP 7.0, which is end of life.
    – The hosting control panel often allows the PHP version to be set on a per site basis (e.g. in cPanel: Software >> MultiPHP Manager: https://snipboard.io/uwN9SM.jpg).
    – If you are unsure, you could a) contact your host for support, and/or b) check in Site Health to see which version of PHP the sites is running, and therefore whether the .htaccess or php.ini directives are being followed.
    – if the PHP version is being set by the hosting control panel, it is better to make changes there rather than manually in the file itself.

    • This reply was modified 2 years, 9 months ago by barnez. Reason: final point added about avoid overriding directives set in the control panel

    And to err on the side of caution, take a backup of any file before making any changes.

    Thread Starter webdad2000

    (@webdad2000)

    Thanks, yeah, I’ve looked at / done the following already:

    1. Through Bluehost CPanel, I’ve set the site’s PHP version to 7.4 (that didn’t have any impact on site health’s reporting)

    2. I originally manually edited .htaccess and changed the above to point to 7.4, that worked fabulously and site health was happy …. until .hcaccess was rewritten.

    Can I just move the AddHandler line outside the WordPress block? My thought was that if I did, it would just get recreated again when the .htaccess file was rewritten.

    Can I just move the AddHandler line outside the WordPress block?

    Yes.

    My thought was that if I did, it would just get recreated again when the .htaccess file was rewritten.

    Only code nested nested in the

    BEGIN WORDPRESS
    ....
    END WORDPRESS

    block of code will be overwritten by WordPress on update or flushing of the permalinks in Setting.

    Thread Starter webdad2000

    (@webdad2000)

    I moved the AddHandler line outside of the BEGIN / END WORDPRESS block. That seemed to work until I upgraded my Paypal gateway, which forced a rewrite of the .htaccess file.

    At that point the AddHandler for PHP 7.0 returned (inside the block) and upon looking at the .htaccess file, I had both AddHandler lines.

    I had moved the 74 AddHandler line above the BEGIN/END block.

    Any ideas on where I can get WordPress to stop focusing on PHP 7.0 and either write the correct AddHandler or not write an AddHandler line for PHP at all?

    Thanks

    A plugin must be adding that directive, which is not normal behaviour. What plugins are installed? Are there any must-use plugins?

    Thread Starter webdad2000

    (@webdad2000)

    Interesting. Greatly appreciate the help in figuring this out.

    Must-Use Plugins:

    Elementor Safe Mode Version 1.0.0 by Elementor.com
    Endurance Page Cache Version 2.0.7 by Mike Hansen
    Endurance PHP Edge Version 0.2 by Mike Hansen
    Health Check Troubleshooting Mode Version 1.7.1
    SSO Version 0.3 by Garth Mortensen, Mike Hansen`

    Active Plugins:

    Advanced Custom Fields Version 5.9.9 by Delicious Brains | Auto-updates enabled
    Advanced Editor Tools (previously TinyMCE Advanced) Version 5.6.0 by Automattic | Auto-updates enabled
    Advanced Order Export For WooCommerce (Pro) Version 3.1.6 by AlgolPlus (Latest version: 3.1.9) | Auto-updates enabled
    Akismet Anti-Spam Version 4.1.10 by Automattic | Auto-updates enabled
    Astra Hooks Version 1.0.2 by Brainstorm Force | Auto-updates enabled
    Astra Pro Version 3.5.5 by Brainstorm Force | Auto-updates enabled
    Bluehost Version 2.8.0 by Bluehost | Auto-updates enabled
    CartFlows Version 1.7.0 by CartFlows Inc | Auto-updates enabled
    Central Color Palette Version 1.15.5 by Daniel Menzies | Auto-updates enabled
    Elementor Version 3.3.1 by Elementor.com | Auto-updates enabled
    Elementor Pro Version 3.3.4 by Elementor.com | Auto-updates enabled
    ELEX USPS WooCommerce Shipping Version 4.3.9 by ELEX | Auto-updates enabled
    Essential Addons for Elementor Version 4.8.1 by WPDeveloper | Auto-updates enabled
    Google Analytics for WordPress by MonsterInsights Version 7.18.0 by MonsterInsights | Auto-updates enabled
    Google Maps Widget PRO Version 5.47 by Web factory Ltd | Auto-updates enabled
    Google Tag Manager for WordPress Version 1.13.1 by Thomas Geiger | Auto-updates enabled
    Jetpack Version 9.9.1 by Automattic | Auto-updates enabled
    Nextend Social Login Version 3.0.29 by Nextendweb | Auto-updates enabled
    Nextend Social Login Pro Addon Version 3.0.29 by Nextendweb | Auto-updates enabled
    Plugins List Version 2.4.4 by David Artiss | Auto-updates enabled
    Really Simple SSL Version 5.0.3 by Really Simple Plugins | Auto-updates enabled
    Really Simple SSL pro Version 5.1.0 by Really Simple Plugins | Auto-updates enabled
    Shortcodes Ultimate Version 5.10.1 by Vladimir Anokhin | Auto-updates enabled
    ShortPixel Image Optimizer Version 4.22.2 by ShortPixel | Auto-updates enabled
    Site Kit by Google Version 1.37.0 by Google | Auto-updates enabled
    TablePress Version 1.14 by Tobias Bäthge | Auto-updates enabled
    The SEO Framework Version 4.1.4 by The SEO Framework Team | Auto-updates enabled
    W3 Total Cache Version 2.1.5 by BoldGrid | Auto-updates enabled
    WooCommerce Version 5.5.2 by Automattic | Auto-updates enabled
    WooCommerce Admin Version 2.4.4 by WooCommerce | Auto-updates enabled
    WooCommerce Amazon Pay Version 2.0.3 by WooCommerce | Auto-updates enabled
    WooCommerce Custom Product Addons (Free) Version 2.5.3 by Acowebs | Auto-updates enabled
    WooCommerce PayPal Checkout Gateway Version 2.1.2 by WooCommerce | Auto-updates enabled
    WooCommerce Shipping & Tax Version 1.25.17 by WooCommerce | Auto-updates enabled
    Wordfence Security Version 7.5.4 by Wordfence | Auto-updates enabled
    WP-Optimize – Clean, Compress, Cache Version 3.1.11 by David Anderson, Ruhani Rabin, Team Updraft | Auto-updates enabled
    WPForms Lite Version 1.6.8.1 by WPForms | Auto-updates enabled
    WP Media folder Version 5.3.18 by Joomunited (Latest version: 5.3.19) | Auto-updates enabled
    WP Paint – WordPress Image Editor Version 0.5.1 by ZetaMatic | Auto-updates enabled`

    According to this support topic, the Endurance PHP Edge Version 0.2 plugin is likely to be the culprit.

    It appears to set the PHP version when the .htaccess rules are saved, but as you are doing that manually, and it is not saving the directive for the correct PHP version, it sounds like it serves no useful purpose.

    You will need to access the site files via FTP or the control panel provided by BlueHost. Navigate to /wp-content/mu-plugins/. In that directory, there should be a folder or file named Endurance-PHP-Edge. Deactivate it by renaming to Endurance-PHP-Edge.hold and then try to reave the permalinks in the WordPress dashboard >> Settings. Assuming the issue is resolved and that line no longer appears in the WordPress part of .htaccess, and you experience no other issues on the site, you can either download the file/folder and keep as a backup just in case any odd behaviour is noticed, or delete it directly.

    Finally, your manually inclusion of the AddHandler code for PHP 7.4 should fucntion correctly 🙂

    Thread Starter webdad2000

    (@webdad2000)

    Thank you! I’ll take a look at that and work on the changes.

    Thanks so much for the assist!

    Some interesting additional information.

    Bluehost is my provider, and they evidently have some contribution to creating this endurance PHP plugin – https://www.dev2qa.com/how-to-enable-disable-bluehost-endurance-page-cache/ The article references 3 different cache scripts, of which Endurance-PHP-Edge is one of them.

    Here is another related thread that echoes your issue: https://wpmudev.com/forums/topic/corrupt-htaccess-code-being-added/

    Note that the latest version of the Endurance-PHP-Edge plugin states:

    // This must-use plugin has been deprecated. Feel free to delete this file.

    Thread Starter webdad2000

    (@webdad2000)

    Thanks again. I’ll get rid of the rest of the files.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘WordPress resetting PHP version in .htaccess’ is closed to new replies.