I took the time to create a new Linux container for testing an upgrade from Ubuntu 20.04 LTS to Ubuntu 22.04 LTS for my ClassicPress website. I have imported the database and ClassicPress files into my new Linux container and everything is working in Ubuntu 20.04. After I performed an upgrade to 22.04, Apache is not reading the index.php file and instead outputs as follows:
<?php
/**
* Front to the ClassicPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells ClassicPress to load the theme.
*
* @package ClassicPress
*/
/**
* Tells ClassicPress to load the ClassicPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the ClassicPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
Everything is working with Ubuntu 20.04 with PHP 7.4, but not Ubuntu 22.04 with PHP 8.1. I could jump to conclusion that ClassicPress does not support PHP 8.1 yet, but I am not sure why Apache outputted an index.php file as plain text instead of PHP for 22.04.
I use the lxc-create/lxc-start/lxc-attach commands for creating, starting, and running a container and everything went well.
For my production website, I’m still going to stick with Ubuntu 20.04 LTS.
And I almost forgot. Even though I enabled a2enconf php7.4-fpm for Ubuntu 20.04 LTS and everything went well, after upgrading to Ubuntu 22.04, I had to manually enable php8.1 module and php8.1-fpm configuration for it to work, but nothing has changed even if I enable them in 22.04. Apache still outputs a plain-text PHP file regardless of the changes I made after an upgrade to 22.04.
Update: Okay, I created a phpinfo.php file in the root folder of my web server in a testing environment and I added the line as follows:
<?php phpinfo(); ?>
Once I do that, I am able to read the contents of PHP file such as the operating system, PHP version, and any other information outputted by phpinfo()
function. So it’s not the Ubuntu upgrade that’s the problem, it’s that ClassicPress does not support PHP 8.1, so I’m staying with PHP 7.4 in Ubuntu 20.04 for the time being.
Update 2: I might try staying with Ubuntu 20.04 and use a PPA to upgrade to 8.1 to see if I could rule out the problem, but I think this might happen the same thing as upgrading to 22.04 had caused.