As most of you must have noticed, fansites have suffered a lot of attacks this couple of months and making some tests in our test server we realized that sites running under PHP 7.2 were not being infected, we also forced the infection and it did not expand as fast as running 5.6.
One of the reasons why fansites are not already running PHP 7.2 is because Coppermine was not compatible with PHP 7.2, however, Coppermine is already compatible with it and the only reason why it has not been released as stable –hence why Softaculous has not automatically updated it– is because Coppermine team is still working on 1.6 documentation, however, as you will notice once upgraded there is not many differences -if any, as most of them are just PHP codes- between versions.
Why PHP 7.2? To make a short resume, 7.2 version is faster, uses less CPU and RAM and is safer than out-dated 5.6. PHP 7 version is already on 7.3 version and we were still using PHP 5.6 due to Coppermine. So just by switching to PHP 7 you will be making your site run faster and be more secure.
HOW TO UPGRADE COPPERMINE (Click on the pictures to make them bigger)
1. Login to cPanel or your host control panel and backup your gallery files and databases, that is, zipping all your gallery files except the /albums folder and exporting your gallery database. (This is optional, however, it is for safety)
2. Upload the file “cpg_installer_stub.php” into your gallery main folder (you will need to unzip it first). [Download file here]
3. Now enter on yoursite.com/yourgallerypath/cpg_installer_stub.php (example: meghantrainordaily.net/photos/cpg_installer_stub.php or meghanpictures.net/cpg_installer_stub.php if your gallery is on a domain)
4. Click on the first option (even if it is not the same as the one in the picture) and then “perform selected update”
5. Once it runs, click on “Complete Update”
6. Choose MYSQLI and click on “continue”
7. Done! You will see an output similar to the following once your gallery has been updated:
8. Plugins Update!
NOTE: Plugins should be automatically updated during the upgrading process, check via FTP or File Manager in cPanel your plugin folder. If the “last modification” date is the day you are performing the update, you are fine! If any of the plugin’s folder has another date you will need to upload only those ones.
You may need to update some plugins to make them work with Coppermine’s latest version.
- List of compatible plugins and download links: https://github.com/coppermine-gallery/cpg1.6.x-plugins
- Check the list above and check which plugins you have installed in your Coppermine installation, download them and replace them with this new version if they have not automatically been updated.
NOTE: Please, make sure you are using CPMFetch latest version, we have seen a lot of people using old versions and it causes a lot of hacks. If you are not sure, just re-install it.
You can download latest CPMfetch version here, if your cpmfetch installation has some errors you are definitely using an outdated version.
9. Theme Update: Go to your current theme, open and edit theme.php file, if it’s empty leave it this way, if it’s not every time it says mysql_ replace it with cpg_db_. For most cases this default theme.php file will also make the trick: [download here].
Your gallery has been updated! However, we are not done yet! Now you will need to change your site PHP version to PHP 7.2. This second part of the tutorial is made for cPanel users, if your host is using another control panel you will need to check where to change PHP version (if possible).
1. Hosts with CloudLinux + PHP Selector (FansCity’s case)
1.1 Login into cPanel and look for Select PHP Version, open it.
1.2 Now select PHP version to 7.2, click on “set as current” and “save”
Note: if there are not “ticks” on the boxes, click on “use defaults” before saving.
2. Hosts without CloudLinux + PHP Selector
2.1 Login into cPanel and look for “MultiPHP Manager”.
2.2 Choose PHP Version ea-php-72 or alt-php-72 (this last one should only be available if your host has CloudLinux, but some hosts with CloudLinux hide “Select PHP Version” feature from clients so they do not confuse it with MultiPHP Manager”, ask your host which one is the best for you!
2.3 Click on Apply
OK… Done! But my wordpress is showing up some errors
If your WordPress is showing up some errors is because there are some incompatibilities between WordPress and any plugin you have installed in WordPress, revert PHP Version to PHP 5.6 and look for which plugin is causing the error, my recommendation is to look for an alternative for that plugin as 5.6 version is already too old and will make your site insecure, if that plugins has not been updated to work with 7.2, then it is not safe to run it, you may ask for 7.2 compatibility in the comments below or submitting a support ticket.
If you are a FansCity member and have any issue, submit a ticket. If you are not hosted with us you can always leave a reply in comment and will try to solve any issue you have.
USEFUL: The WordPress “PHP Compatibility Checker” plugin can help you check which plugins are compatible with PHP 7.2 and which are not. Once installed go to WordPress > Tools > PHP Compatibility. Note that if it shows some small errors it will keep working on PHP 7.2, switch PHP version to see if it is really compatible or not, the plugin can be 100% not correct.
Everything looks fine now!
If everything looks fine on your site and everything works OK! You are done.
My site does not work on PHP 7.2 but does work 7.1 or 7.0, what do I do?
Submit a support ticket, we will help. However, if it does not work with 7.2 and does with 7.1, go ahead and use 7.1 but do not keep using 5.6 or 7.0 as are deprecated.
I use CoppermineSC and is not compatible with > PHP 7.0. What do I do?
You can use PHP 7 compatible version here.
One of my plugins is not compatible, what can I do?
For simple plugins we can try to make it compatible for you, submit a ticket or leave a comment below (non-hosted), for advanced plugins, please, look for an alternative. Out-dated plugins can cause hacks.
OK.. My gallery works but there are some errors in my themes, some parts are not showing and/or full size pictures are not working, what can I do?
If your theme is using working theme.php, open and edit that file, every time it says mysql_ replace it with cpg_db_. For most cases this default theme.php file will also make the trick [download here].
I am creating a new fansite and installing Coppermine, what should I do?
You can either install old version vía Softaculous and then upgrade with cpg_installer_stub, or download latest stable version of 1.6 vía Github (https://github.com/coppermine-gallery/cpg1.6.x/releases). You must download the source code.