PHP 8 Works With CORE WordPress
I have actually done the PHP upgrade on my server that hosts this WordPress website. Things to know about this website, the server is Apache2, most of my posts I made using Elementor and that includes pages as well.</p> <h3>So What Were My Results?</h3> <p>It unfortunately broke the front end of my site. Automattic says that they made WordPress 5.6 compatible with PHP 8, and I believe them. The WordPress Dashboard actually worked just fine. From what I am able to tell right now, it is just Elementor that might be having the problems. If all my post were done through self-made templates then there would not be a problem.</p> <h3>I Didn't Answer If You Should Upgrade</h3> <p>I mean if you aren't using Elementor, maybe, or if you feel like redoing your posts, maybe. The only other issue is that <a href="https://www.wordfence.com/blog/2020/12/episode-97-the-future-of-wordpress-with-php-8-and-wordpress-5-6/">WordFence</a> gave me a message saying they are still working on WordFence compatibility. This means there might be issues with security if that is the plugin you are relying on.</p> <h3>Know What You Are Doing</h3> <p>If you know how to rollback your PHP version, you aren't using Elementor for most of your posts, and aren't relying on WordFence then try it. Let me know your experiences, maybe before you do run a speed test and compare to see if it's worth it. </p> <h3>Changing PHP 8 Version</h3> <p>This is specific for Apache2 on Ubuntu, and I am not going over the <a href="https://linuxize.com/post/how-to-install-php-8-on-ubuntu-20-04/">install commands</a>, you can find them anywhere. What the guides usually do not tell you though is how to change your module Apache2 is using properly.</p> <code>sudo a2enmod php8.0</code> <p>When you have used some instructions on how to download the Apache module, that is how you enable it. Again, this assume you are using apache2 as that is what the a2 at the beginning implies. Apache2 Enable Mod...the command makes a whole lot of sense. Is that all you have to do? No, if you had a previous version of PHP running like me, you have to disable that mode</p> <code>sudo a2dismod php7.4</code> <p>My other version of PHP and the one probably running while you read this unless I got ambitious is 7.4. If you do not disable the previous version you had running apache will not reset correctly and your server will go down.</p> <code>sudo systemctl restart apache2</code> <p>Once you have done things correctly, and have only one version of a PHP module for Apache running. Restart Apache2 with the above command. You can test your WordPress under PHP 8. If your site is broken afterward, then reverse what was done. Create another environment, import your posts and rebuild your theme using tools that work with PHP 8.</p> <h3>Reversing PHP 8 Spelt Out</h3> <pre><code>sudo a2dismod php8.0
sudo a2enmod php7.4
sudo systemctl restart apache2
Extra Fun Fact
Most Linux if not all Linux systems (I haven’t used every Linux distribution) auto complete when you hit tab, so if you can’t remember which PHP module you have active, or are scared you activated both. You can just type[wpforms id=”12401″]
sudo a2dismod php
At this point just hit tab and it should show you the options of what you might mean based on what makes sense and what is currently active. If you only have one module active correctly, it will just autocomplete that version.
sudo apache2ctl -M
The Above will list the modules in case you went crazy and need to check.
That is all from me today, if you have some experience with PHP 8 on WordPress and WordPress plugins let me know. I can only speak from my experience which is a very specific environment.
<figure> <img width="271" height="66" src="https://ganstapenguin.com/wp-content/uploads/2021/04/imageused.jpg" alt="Yoast Saying I need an Image" loading="lazy" /> <figcaption>Do not mind this, just being a great SEO person.</figcaption> </figure>