Upgrading Nextcloud on Fedora: A Journey from PHP Errors to Success
Step 1: Identifying the Issue
I recently upgraded my Nextcloud instance on a Fedora server and faced several challenges, from compatibility issues with PHP 8.2 to database schema errors. Here’s how I navigated through the process.
Initially, I encountered an error stating my Nextcloud version was incompatible with PHP 8.2. To address this, I decided to upgrade Nextcloud instead of downgrading PHP.
Step 2: Downloading and Preparing the New Version
I downloaded the latest Nextcloud release:
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
I then enabled maintenance mode and backed up my current Nextcloud directory:
sudo -u apache php /path/to/nextcloud/occ maintenance:mode --on
mv /path/to/nextcloud /path/to/nextcloud-old
cp -r nextcloud/* /path/to/nextcloud/
Step 3: Running the Upgrade
Copying the config.php and data directory from the old installation, I attempted the upgrade:
sudo -u apache php /path/to/nextcloud/occ upgrade
However, I faced a SQL error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lazy' in 'field list'.
Step 4: Resolving Database Schema Issues
To fix this, I manually added the missing lazy and type columns to the oc_appconfig table:
ALTER TABLE oc_appconfig ADD COLUMN lazy TINYINT(1) NOT NULL DEFAULT 0;
ALTER TABLE oc_appconfig ADD COLUMN type INT(11) NOT NULL DEFAULT 2;
Step 5: Incremental Upgrades
Attempting to jump directly to version 29 failed, so I opted for a step-by-step upgrade:
- Downloaded version 26.
- Replaced files and copied
config.php. - Ran the upgrade:
cd /path/to/nextcloud
./occ upgrade
Step 6: Increasing PHP Execution Timeout
To handle long-running processes, I increased the PHP execution timeout by editing the php.ini:
max_execution_time = 300
and restarting the web server:
sudo systemctl restart httpd
After upgrading to version 26, nextcloud is now up and running again. Next step was updating it through the web interface, as usual – one major version at a time.
Conclusion
By carefully addressing each issue, from compatibility errors to database schema adjustments and PHP configurations, I successfully upgraded my Nextcloud instance. This step-by-step approach ensures a smooth transition, minimizing downtime and maintaining data integrity.