Jose Manuel Andrade Pereira's picture

Good morning, afternoon or evening to the entire turnkey Linux community.

A few days ago I was testing LAMP to install a WordPress blog, and I came up with the idea of upgrading to php 7.3 for WordPress security requirements, I have been reading on several forum sites and other web pages to upload it to php 7.3 and Do not fail in the attempt.

How update Turnkey Lamp 15.1 PHP 7 to PHP 7.3

1. Deploy LAMP VM or Physical Machine, apply updates and any stuffs.

2. Goto ShellBox, enter credentials:

apt-get -y install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
apt-get update

Reboot your VM o Wait to Refresh new Repo.

apt update
apt install php7.3
a2dismod php5 php7.0
a2enmod php7.3

service apache2 restart

apt update
apt install samba
apt install webmin-samba
apt install php-mysql

service apache2 restart

3. Goto Webmin, and then go System->PHP Configuration-> click top left gear, and change

/etc/php/7.3/apache2/php.ini=Configuration for mod_php
/etc/php/7.3/cgi/php.ini=Configuration for scripts run via CGI
/etc/php/7.3/cli/php.ini=Configuration for command-line scripts

4. Save Done.

NOTE: If there is something I missed, let me know, I think it works fine for now and it has been updated to PHP 7.3 correctly.

-----------------------------------------------
[optional] wordpress php 7.3 essentials:

apt install php7.3-bcmath
apt install php7.3-curl
apt install php7.3-imagick
apt install php7.3-gd

Forum: 
Jeremy Davis's picture

I'm sure others will get value from your post, so thanks for sharing.

FWIW, I'm currently working on our v16.0 release (based on Debian 10/Buster). There is no ETA yet (will be released ASAP - i.e. "when it's ready"). TurnKey v16.0+ appliances that include PHP will provide PHP7.3 by default (from the Debian repos). Although we may well include the sury.org repo to allow users to update (or downgrade) PHP if they wish (most likely disabled by default).

zyrus's picture

Hello,

thx for the greate contribution.
I have a question above your constribution.
Can I do that exactly the same way by Turnkey Linux Wordpress VDI?

Thx fpr your answer :)

Jeremy Davis's picture

Yes, Jose's instructions should work with any v15.x version of TurnKey WordPress. In fact, it should also apply to any v15.x LAMP based TurnKey server! :)

Depending on which plugins you are using, you may need/wish to install some additional PHP libraries. Although if you follow Jose's instructions, that should be enough for most scenarios.

If you have any issues, please post back.

Rusty Meyners's picture

Jose's command list worked beautifully for me with one or two exceptions. My Webmin didn't support the php.ini edit as explained but didn't seem to matter in the Wordpress operation. One "optional essential" that I added - after almost getting locked out (sorta) - was: apt install php7.3-ldap
L. Arnold's picture

Finally got the PHP to stick to Joomla this way.

We need to document this a bit more but Very Nice!

 

 

Piotr Jeremicz's picture

Hi everybody,

I have a big problem with updating my PHP on the LAMP server. Following this tutorial I stopped on the command:

apt install php7.3

Unfortunately, I am getting an error:

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.3
E: Couldn't find any package by glob 'php7.3'
E: Couldn't find any package by regex 'php7.3'

Next, I am trying to follow the different tutorial and use these commands:

apt-get install software-properties-common
apt-add-repository ppa:ondrej/php

I will be glad for any help. Right now I am totally stopped with the project.

Jeremy Davis's picture

First up, assuming you are running a TurnKey server, then it's a really bad idea to install Ubuntu packages on TurnKey! TurnKey is based on Debian. Whilst Ubuntu is also based on Debian, it's not binary compatible (TurnKey is). For me info, please see the "Don't make a FrankenDebian" section of the "Don't break Debian" wiki page.

I really hope that you didn't get too far because cleaning that up might be an issue...!

Next up, these instructions should be working fine. I can only suggest that either you missed a step, copy/pasted something wrong, or there was some other glitch. Perhaps the "apt update" step failed for some reason? Posting the full output of what you did might help? The output of 'apt update" in particular.

If you've already installed packages from an Ubuntu PPA, you'll need to fix that first and get rid of them and remove the PPA from your sources lists. Ideally rolling back to before you installed any of that is probably a good idea if possible. Once you've got back to where you were, then more than happy to try to help you out. If you've installed Ubuntu packages and can't roll back (even if everything seems to be working ok at the moment), then I would suggest trashing this server and starting again. I'm almost certain that continuing on with Ubuntu PPA PHP packages will bite you at some point!

Allen Macchia's picture

I followed the instructions above and now get the following error after refreshing.. "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." Anyway to correct this or should I start over. Thank you!
Jeremy Davis's picture

Double check what version of php-mysql is installed like this:

apt policy php-mysql

It should be the same as the version of PHP you are trying to update to. Alternatively you could try explictly installing the version you need, like this:

apt install phpX.Y-mysql

Where X.Y is the version of PHP you are trying to install. E.g. 7.3.

Dan Kelley's picture

I am using the V 16 turnkey LAMP appliance in production, also in development. I noticed my version of PHP is 7.0.33 but I read version 16 of turnkey LAMP should be PHP 7.3 so Im not sure why mine is not... must be an old version of 16. Would it be best to try and upgrade PHP on my existing appliances or install new ones and then get them working.  I remember making several modifications to get various things working....   Installing curl, some other stuff. Here is my cheat sheet: Apt-get update Apt-get install php-gd Apt-get install php-soap Apt-get install php-curl Apt-get install php-mbstring   So what would be best?  
Jeremy Davis's picture

All TurnKey v16.x appliances are built on Debian Buster/10 and PHP is installed direct from the Debian apt repositories. PHP 7.3 is the only version of PHP available from the official Buster repositories.

To double check, try running this:

turnkey-version

It should return this (for v16.0 LAMP):

turnkey-lamp-16.0-buster-amd64

If you only have PHP 7.0, then it's likely a v15.x release (likely v15.1 or later). Assuming v15.1, it should return this:

turnkey-lamp-15.1-stretch-amd64

(v15.x was based on Debian Stretch/9)

But back to your question, I would recommend installing a v16.0 appliance (and be sure that you actually do get v16.x). Then you could use TKLBAM (our custom backup and data migration tool) to migrate your data across if you wish. That should hopefully even take care of installing the additional packages I suspect (although I can't be 100% sure).

Alternatively, you could migrate your data manually. I.e. copy across your files (by default will be in /var/www) and your DB. Then install your additional modules as per your notes; although you can use the shorter apt command instead, plus the packages can all be installed on the one "apt install" line - like this:

apt update
apt install php-gd php-soap php-curl php-mbstring
Dan Kelley's picture

You were right I only have version 15....   Gosh I thought I was staying up to date with the latest and greatest but you really get in to your work for a few minutes... look up.... and 6 months have passed! I am going to look into the TKLBAM migration and backup tool... that sounds amazing as each upgrade has come with its troubles of getting existing applications to work. We run several business critical applications on our turnkey appliance... its been the best and most reliable part of our enterprise.   After two ransomware outbreaks, both times our turnkey VM was the only thing still working!   It has changed our decision process for where to put critical enterprise applications, so a migration and backup tool would be amazing! Thanks so much for your help always Jeremy, you have proven to be a reliable and resourceful guide all these years!

Add new comment