XeoDev site is now running on PHP 8
how did it go?
Mar 3, 2021 | XEO
XeoDev is a Leading B2B Company in Florida.
As a market leader, we need to keep up with the latest technology releases. PHP 8 has been out a while now and AWS does support PHP 8 on their Linux 2 AMI images. I took advantage of the ease of installing from the AWS supported amazon-linux-extras vs trying to pull the latest version from the REMI repo and building it locally. This way it will be easy to upgrade versions in the future.
Standing up the Linux 2 AMI server was fairly straight forward to get the LAMP stack running. The XeoDev site doesn't use a database so that made it a lot simpler. We use a flat file based blog framework for our blog which works fine. I do have to get into the nitty gritty for each post, but it just means I use my code editor to write blog posts. I did have to to fiddle with the opcache settings to get the JIT working but there was good support on stack overflow. The only feature I couldn't get working was PageSpeed which wasn't available in any repo on the machine. If you know how to set up PageSpeed on AMI 2 please message David on linked in (see aboutus page)
Got the site to load but ended up having a problem with CSS and JS files not loading. This was fixed by removing the defer and async tags from the load elements. I'm thinking it is serving up faster now and those dependencies are needed earlier than before. The pages feel like they load faster but the network tab in Chrome shows about the same speed numbers as the PHP 7 version. I guess there isn't that much PHP code in use in this static site to make a big difference.
I went back to CloudFlare where I have the DNS hosted and CDN setup and made sure all the speed items were checked like Rocket Loader and all the new HTTP 3 options. These made both the PHP 7 and PHP 8 sites faster. The site uses several old plugins which I will replace over time so they drag the performane down and force me to use jQuery 1.x but changing them out is surgery for another day.
'The project page is broken' – Ray Fanous
This was a wierd issue. there were no logs just an abrupt end to the page output after most of the first project. I ended up putting echo statements on each line and finding out that I was using implode wrong. PHP 8 is more strict about argument order. I fixed that in three places and all was well.
Then I noticed several Font Awesome icons didn't load and were the wrong size. Ends up the site was using 4.7.2 which is pretty old now. I upgraded to 5.12.2 but I couldn't get the fontawesome.min.css file to show up in the network panel - how frustrating! After a while browsing on the Font Awesome site, I triggered a login action which let me download a js key and after adding that line, all was well. Just adjusted the syntax to use fas and fa-fw for all the icons to be uniform. Yeah, I know Font Awesome 6 is out but that's for another day.
Should I upgrade to PHP 8? Yes! How much faster is PHP8? That depends. Keeping up with the latest major version of PHP is important to avoid building up significant technical debt. Stay tuned for more news about PHP 8. That was my experience with PHP8. Please share yours with the contact us form.