vccw icon indicating copy to clipboard operation
vccw copied to clipboard

Upgrading PHP to 7.1 / 7.2

Open jgraup opened this issue 6 years ago • 17 comments

Is there a preferred way to upgrade the environment to php 7.1 or php 7.2?

Currently php 7.0 is bundled with the box. According to http://php.net/supported-versions.php - 7.1 ends active support on Jan 1, 2019 which isn't terribly far away.

Thanks

jgraup avatar Aug 07 '18 13:08 jgraup

+1

If I update with apt-get install, use 7.2 instead of 7.0, restart apache, the mailcatcher doesn't work anymore.

harkor avatar Aug 15 '18 12:08 harkor

In our fork we use ppa:ondrej/php for supporting multiple php versions (for now we only need 5.6) and we use ansible to install php and enable required headers;

@harkor I guess that problem with 7.2 and mailcatcher is that there is no /etc/php/7.0/apache2/conf.d/99-vccw.ini file because file for 7.0 is provisioned trough ansible and there is custom sendmail_path = /usr/bin/env catchmail directive at the end of that file so i guess if you add that to 7.2 it should work (also switching to php7.2 mod in apache etc...);

lzivadinovic avatar Nov 06 '18 12:11 lzivadinovic

@lzivadinovic

Thanks for your clarification. We will update it. (I am very happy if you can send PR. 😊 )

miya0001 avatar Nov 14 '18 17:11 miya0001

@miya0001 Its not a problem for me to write pre-step where php version could be read from site.yml and box configured according to selected version. What i dont like in that approach is that user first downloads vccw box with already installed php7.0 (https://github.com/vccw-team/vccw-xenial64/blob/master/provision/playbook.yml#L62 ) and then modifies that installation. Also, i really dont see the point in using pre-packed box at all it kills modularity if you want to, for example, change php version. Also its just a hassle to update box when bento/ubuntu-16.04 box is updated, you could simply use ubuntu/xenial64\bionic64 as base and do a provisioning here (only downside i see there is longer up time, by i guess no more than 2 minutes :) ) But its your approach.

If its ok for you to change php version while provisioning later on (i.e. setting up php version in site.yml in this repo) i could send you PR and i would be glad to contribute to project. Proposed soluion is following:

  • Add new environmental variable for selecting desired version of php from ondrej
  • Install and reconfigure php with appropriate php.ini for that specific version of php
  • if version of php is left at standard php7.0 i could just skip initial php install/configure role

Tell me if you agree on proposed solution and ill send you a PR in few days.

lzivadinovic avatar Nov 20 '18 20:11 lzivadinovic

@lzivadinovic @miya0001 @harkor @jgraup

Guys, but how do we set what PHP to use in the default.yml ? before we hit vagrant reload --provision?

That's the place to set it right?

using this doesint work, composers:

  • phpunit/phpunit:7.3
  • squizlabs/php_codesniffer:~2.0
  • wp-coding-standards/wpcs:*

it just makes version like this: 7.0.26-2+ubuntu16.04.1+deb.sury.org+2

Another question: Also when i tried to do 'vagrant reload --provision' it deleted my database which was very unfortunate. Any idea how to update php to 7.3 without deleting the database?

IanZea avatar Sep 17 '19 19:09 IanZea

according to following article: https://qiita.com/miya0001/items/2499917d7ec3bc905781

the solution is to execute following command on guest:

curl https://raw.githubusercontent.com/vccw-team/change-php-version/master/run.sh | bash -s -- 7.3

and create following file on "Vagrantfile" directory:

provision-post.sh

#! /usr/bin/env bash

set -ex

curl https://raw.githubusercontent.com/vccw-team/change-php-version/master/run.sh | bash -s -- 7.3

amaguri1505 avatar Feb 05 '20 13:02 amaguri1505

@harkor

If I update with apt-get install, use 7.2 instead of 7.0, restart apache, the mailcatcher doesn't work anymore.

You need to change the 'sendmail_path' as follows. /etc/php/7.2/apache2/php.ini sendmail_path = /usr/bin/env catchmail -f [email protected] and sudo service apache2 restart

tkc49 avatar Jun 18 '20 13:06 tkc49

according to following article: https://qiita.com/miya0001/items/2499917d7ec3bc905781

the solution is to execute following command on guest:

curl https://raw.githubusercontent.com/vccw-team/change-php-version/master/run.sh | bash -s -- 7.3

and create following file on "Vagrantfile" directory:

provision-post.sh

#! /usr/bin/env bash

set -ex

curl https://raw.githubusercontent.com/vccw-team/change-php-version/master/run.sh | bash -s -- 7.3

Hi @amaguri1505 Just wondering if you know about what have happened to the Xdebug after updating the PHP. Because in my case, there is no Xdebug installed and I am having a hard time trying to figure out how to reconfigure the settings for it to work. If you have to know, do you mind sharing with me any helpful resources? Thank you!

litone01 avatar Sep 15 '20 17:09 litone01

I know this is old but I really need to figure out how to update php version so newer themes will run locally.

@litone01 in your post above you say to run that execute that curl command, from my vagrant dir? then I create the provision-post.sh file in my vagrant directory as well? Then run vagrant provision?

Sorry a little new to vagrant boxes so I yu could over explain the answer I might be able to get it to work.

brianmdesigns avatar Jan 13 '22 16:01 brianmdesigns

I know this is old but I really need to figure out how to update php version so newer themes will run locally.

@litone01 in your post above you say to run that execute that curl command, from my vagrant dir? then I create the provision-post.sh file in my vagrant directory as well? Then run vagrant provision?

Sorry a little new to vagrant boxes so I yu could over explain the answer I might be able to get it to work.

@brianmdesigns Nope it is not my post (I am just quoting the previous reply) :( It has been a long time and I have not been using PHP and wordpress for some time, so I cant really recall the solution I adapted at that time. Maybe you can use google translation and follow this link https://qiita.com/miya0001/items/2499917d7ec3bc905781, which is also from the discussion above.

litone01 avatar Jan 13 '22 16:01 litone01

@brianmdesigns

Do you want to use PHP versions?

tkc49 avatar Jan 26 '22 01:01 tkc49

I just want to know of a way to load the latest php version

On Tue, Jan 25, 2022, 8:50 PM Takashi Hosoya @.***> wrote:

@brianmdesigns https://github.com/brianmdesigns

Do you want to use PHP versions?

— Reply to this email directly, view it on GitHub https://github.com/vccw-team/vccw/issues/333#issuecomment-1021779307, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO6H5IM6ABM3UUJ7WTRCPLDUX5HPDANCNFSM4FOIXQYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

brianmdesigns avatar Jan 26 '22 03:01 brianmdesigns

@brianmdesigns @litone01

The current version of VCCW does not seem to be able to upgrade PHP. This is because the version of Ubuntu os is old. I think we need to upgrade Ubuntu os.

tkc49 avatar Jan 26 '22 04:01 tkc49

Hmmm ok will that be happening or do we just pick a new box. I like how VCCW has one config file with all the variables. I use VVV too but I just enjoy the flow of VCCW a little better. So is there any way to add PHP variables in the site.yml and maybe update the Ubuntu box?

On Tue, Jan 25, 2022 at 11:40 PM Takashi Hosoya @.***> wrote:

@brianmdesigns https://github.com/brianmdesigns @litone01 https://github.com/litone01

The current version of VCCW does not seem to be able to upgrade PHP. This is because the version of Ubuntu os is old. I think we need to upgrade Ubuntu os.

— Reply to this email directly, view it on GitHub https://github.com/vccw-team/vccw/issues/333#issuecomment-1021855191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO6H5IL2HROMSSSSGZLRTV3UX53K5ANCNFSM4FOIXQYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

brianmdesigns avatar Jan 26 '22 13:01 brianmdesigns

@brianmdesigns

I have tried the following box files. Unfortunately, if we change the box file, we will also need to change the playbook configuration files. It will be a very big change and take time.

  • https://app.vagrantup.com/generic/boxes/ubuntu1804
  • https://app.vagrantup.com/ubuntu/boxes/bionic64
  • https://app.vagrantup.com/giusetavera/boxes/wplamp

You can use PHP7.4 if you do the following. The following tasks are installed PPA( Personal Package Archive ) at your own risk.

vagrant up vagrant ssh sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp sudo apt-get update https://raw.githubusercontent.com/vccw-team/change-php-version/master/run.sh | bash -s -- 7.4

tkc49 avatar Jan 28 '22 03:01 tkc49

I guess I can try but it just seems like VCCW is going to be obsolete then if the PHP version isnt updated. But I dig how the config file is easy to use and follow unlike VVV's but I guess I will just have to use VVV and learn it then. But there's gotta be a way to have the php version in the config file like VVV has.

On Thu, Jan 27, 2022 at 10:59 PM Takashi Hosoya @.***> wrote:

@brianmdesigns https://github.com/brianmdesigns

I have tried the following box files. Unfortunately, if we change the box file, we will also need to change the playbook configuration files. It will be a very big change and take time.

  • https://app.vagrantup.com/generic/boxes/ubuntu1804
  • https://app.vagrantup.com/ubuntu/boxes/bionic64
  • https://app.vagrantup.com/giusetavera/boxes/wplamp

You can use PHP7.4 if you do the following. The following tasks are installed PPA( Personal Package Archive ) at your own risk.

vagrant up vagrant ssh sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp sudo apt-get update

https://raw.githubusercontent.com/vccw-team/change-php-version/master/run.sh | bash -s -- 7.4

— Reply to this email directly, view it on GitHub https://github.com/vccw-team/vccw/issues/333#issuecomment-1023863880, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO6H5INASB4ZQMGIFDBDQULUYIIBNANCNFSM4FOIXQYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

brianmdesigns avatar Jan 28 '22 13:01 brianmdesigns

@brianmdesigns

it just seems like VCCW is going to be obsolete then if the PHP version isnt updated.

Yes, I think so too. And VCCW is running on the Virtualbox. Virtualbox does not support Apple silicon Mac. In order to continue using VCCW, someone needs to change from Virtualbox to Docker.

Currently it is not scheduled.

tkc49 avatar Jan 29 '22 03:01 tkc49