4

I'm running Plesk Version 17.0.17 Update #16 on Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux

My problem is that I cant figure out how to update the global PHP version to 7.1 through Plesk

I need to do this as it is required by a package I am trying to install with Composer.

I cannot remove it because it says that "Plesk is using the old version to run" and I cant seem to change the version that Plesk uses. I can only set it for individual websites and I'm not interested in running more than one PHP version.

I have already installed the new version and I am able to run it when I create a symbolic link like this:

ln -s /opt/plesk/php/7.1/bin/php /usr/bin/php

When I do this everything works fine and the problem only occurs when Plesk updates it and overwrites the path causing me to have to do it again.

I cant just remove the old version through Plesk as it says it conflicts with Plesk itself as it uses it to run.

enter image description here

enter image description here

Summary:

I want Plesk to run PHP version 7.1 and remove the old version completely. How can I do this?

Henders
  • 1,195
  • 1
  • 21
  • 27
Rasmus Stougaard
  • 433
  • 2
  • 11
  • Any news about this ? The difference between Plesk's PHP version and the others is getting ridiculous and searches in Plesk's support never address this. – savedario Mar 09 '19 at 14:01

3 Answers3

1

Maybe better to said composer use specific PHP binary?

For example you can just add the following line into the .bashrc file from your user folder:

export PATH=/opt/plesk/php/7.1/bin:$PATH

Or

echo 'PATH=/opt/plesk/php/7.1/bin:$PATH' >> ~/.bashrc

To verify you have to relogin/recreate bash session and check $PATH variable:

echo $PATH
/opt/plesk/php/7.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Oleg Neumyvakin
  • 9,706
  • 3
  • 58
  • 62
  • 1
    Yes i could do that, but the OS would still be running the 5.0 version right? The problem is not composer you see, it's the php libraries i've installed that requires the 7.0 version. Composer just throws the error on update :) – Rasmus Stougaard Feb 21 '17 at 10:12
  • May you add details in question about which exact issues you get from executing composer? I've asked because it's maybe easier to resolve this issues than replace system PHP with Plesk one (because actually it's impossible). – Oleg Neumyvakin Feb 21 '17 at 11:30
  • Btw, Plesk provides own composer support for code placed in subscrition root, maybe to try it? – Oleg Neumyvakin Feb 21 '17 at 11:33
  • There is a a lot of focus on the composer part of this question. Composer is not the issue as i can get it to run anyways. Composer is just how i spotted the problem. The real question here is how i make either the OS or plesk run the 7.1 php version. To me it would make the most sense if this was possible through plesks own interface.. doesn't seem that way :( – Rasmus Stougaard Feb 22 '17 at 14:02
  • hello i have the same problem but i would like to add export PATH=/opt/plesk/php/7.1/bin:$PATH to .bashrc file ! how i could do that ? i'm not a pro of linux commands !! actually i need to do manualy export PATH=/opt/plesk/php/7.1/bin:$PATH; php composer.phar update – Mathieu Mourareau Jul 13 '17 at 07:48
  • @MathieuMourareau try echo 'PATH=/opt/plesk/php/7.1/bin:$PATH' >> .bashrc – Oleg Neumyvakin Jul 13 '17 at 09:31
  • @MathieuMourareau I've updated the answer how to update .bashrc – Oleg Neumyvakin Jul 13 '17 at 09:39
  • thanks but if i use this , composer will always check for the path php version ? – Mathieu Mourareau Jul 13 '17 at 09:41
  • ok so if i want to update the .bashrc i do : echo 'PATH=/opt/plesk/php/7.1/bin:$PATH' >> .bashrc ? – Mathieu Mourareau Jul 13 '17 at 09:43
  • i try to do it ! so with root connect it worked ! i have now php 7 but with a connection from a user for a specific website when i do echo 'PATH=/opt/plesk/php/7.1/bin:$PATH' >> ~/.bashrc end i check echo $PATH the /opt/plesk/php/7.1/bin is not here ! – Mathieu Mourareau Jul 13 '17 at 12:56
  • @MathieuMourareau maybe user does not use bash? https://stackoverflow.com/questions/3327013/how-to-determine-the-current-shell-im-working-on – Oleg Neumyvakin Jul 14 '17 at 07:25
0

Use this:

apt-get update; apt-get install php{X};

where {X} = version ex. 5

For PHP 5.5, PHP 5.6 and PHP 7.0:

apt-get update; apt-get install php{X};

Then update the package lists and perform the upgrade:

sudo apt-get update

  • Thank you for your answer! Do you know what the version is called for 7.1? I tried apt-get update; apt-get install php7.1; didn't work.. got the error E: Couldn't find any package by regex 'php7.1' – Rasmus Stougaard Feb 20 '17 at 02:51
  • did you try `sudo apt-get update` and what is `php -v` result? –  Feb 20 '17 at 03:08
  • Yeah, but you wrote the same line twice.. sure your not missing something? besides i already have the other version through plesk.. isn't their any way i can just use that? like telling the os to use that instead – Rasmus Stougaard Feb 20 '17 at 03:19
  • may this help: [Link](http://askubuntu.com/questions/565784/how-do-i-upgrade-php-version-to-the-latest-stable-released-version) –  Feb 20 '17 at 03:21
0

Well you should make sure that no website is using the old php version. After that you should be able to remove the old php version from Plesk. You should not have to create a symbolic link manually. That can cause problems with Plesk.

Nadir Latif
  • 3,690
  • 1
  • 15
  • 24