• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Use of different PHP versions in different folders

FrankHe

New Pleskian
I am a happy user of ONYX since a few weeks.

Now I have the following problem.

I am currently in the process of switching my website with CMS to PHP7 and the additional install possibility of PHP in ONYX and the selection possibility made it run well after some modifications in CMS.

The CMS is on www.domainnameplaceholder.ie and in the /blueblue folder there is a forum.

How can I make sure that the forum in /blueblue is running on old / previous PHP version and the main site is running on PHP 7?

I have already checked the handlers with:

/usr/local/psa/bin/php_handler --list

Code:
 id:        display name:  full version:  version:    type:                         cgi-bin:                    php-cli:                        php.ini:  custom:  status:
                  cgi  5.4.45 by OS vendor         5.4.45       5.4      cgi                /usr/bin/php5-cgi               /usr/bin/php5           /etc/php5/cgi/php.ini    false  enabled
              fastcgi  5.4.45 by OS vendor         5.4.45       5.4  fastcgi                /usr/bin/php5-cgi               /usr/bin/php5           /etc/php5/cgi/php.ini    false  enabled
               module  5.4.45 by OS vendor         5.4.45       5.4   module                /usr/bin/php5-cgi               /usr/bin/php5       /etc/php5/apache2/php.ini    false  enabled
      plesk-php56-cgi               5.6.30         5.6.30       5.6      cgi   /opt/plesk/php/5.6/bin/php-cgi  /opt/plesk/php/5.6/bin/php  /opt/plesk/php/5.6/etc/php.ini     true  enabled
  plesk-php56-fastcgi               5.6.30         5.6.30       5.6  fastcgi   /opt/plesk/php/5.6/bin/php-cgi  /opt/plesk/php/5.6/bin/php  /opt/plesk/php/5.6/etc/php.ini     true  enabled
      plesk-php56-fpm               5.6.30         5.6.30       5.6      fpm  /opt/plesk/php/5.6/sbin/php-fpm  /opt/plesk/php/5.6/bin/php  /opt/plesk/php/5.6/etc/php.ini     true  enabled
      plesk-php70-cgi               7.0.19         7.0.19       7.0      cgi   /opt/plesk/php/7.0/bin/php-cgi  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini     true  enabled
  plesk-php70-fastcgi               7.0.19         7.0.19       7.0  fastcgi   /opt/plesk/php/7.0/bin/php-cgi  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini     true  enabled
      plesk-php70-fpm               7.0.19         7.0.19       7.0      fpm  /opt/plesk/php/7.0/sbin/php-fpm  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini     true  enabled

I tried putting a .htaccess in the /blueblue folder, but the phpinfo.php in it did not show the old php version.

Kindly awaiting your reply, many thanks
 
It is not possible to use a different PHP version if a subdirectory is served. But I can imagine many workarounds how to do it. For example you could place the forum into a separate subdomain and create an inline frame page in the subdirectory of the main domain. That way you can use different PHP versions for forum and main domain.
 
Many thanks Peter for your detailed reply,I hoped for easier integration.your solution attempt sounds interesting, but as I want to keep the url structure for Google it seems not possible or am I missing anything? Regards
 
Well, this is quite an old thread, but hopefully this might actually help someone.

I had the problem were I wanted to keep an old store working with an old PHP5.2 version, and I want to install a Wordpress blog on the /blog directory and run it with the latest PHP version. Server running CentOS7 and latest Plesk 17.8.11. According to what I was reading around, this could not be done :(

On Plesk I already have all the needed PHP versions installed (in fact, I just need 5.2 and 7.3).
3B8y5Y6.jpg


My domain is already configured to run with PHP 5.2.17
LCbQ89p.jpg


I create a /blog subfolder, and with the following .htaccess I am able to get the content there to run with... PHP 5.4? Which seems to be the default PHP version for CentOS and/or Apache2.
Code:
#This WORKS! I remove the handler for PHP files, and I add it again with "AddHandler php-script .php".
#But for whatever reason it runs with PHP5.4 and not PHP7.
RemoveHandler .php
<Files ~ (\.php)>
SetHandler None
AddHandler php-script .php
Options +ExecCGI
allow from all
</Files>

So now I am already running a different PHP version on a subfolder. The contents on / with PHP5.2 and the contents on /blog/ with PHP5.4. Wordpress is supposed to work with older PHP versions, but starting from scratch it is better to have it running with the latest PHP version.
JQjgBR9.jpg


The temp_phpinfo.php files just have:
Code:
<?php
phpinfo();
?>

So, using Remi Repository I will install PHP7.3 with the following commands:
Code:
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install epel-release yum-utils
sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php73
sudo yum -y install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
(this information thanks to: How to Install PHP 7.3 on CentOS 7 / Fedora - Computingforgeeks)

Reload the /blog/temp_php_info.php, and there we go! We now have PHP7.3 running on the /blog subfolder, ready to install the latest Wordpress, while the main root folder will keep using PHP5.2.
vZTEjyK.jpg
 
Create a "php-bin" directory in the site docroot and copy php-cgi of the required version into it:

$ cp /opt/plesk/php/5.4/bin/php-cgi ./php-bin/

In the required directory, write in .htaccess:

<Files ~ \.(php)$>
SetHandler fcgid-script
FCGIWrapper /var/www/vhosts/subscription.com/httpdocs/php-bin/php-cgi .php
Options +ExecCGI
allow from all
</Files>

Change group of php-cgi file to psacln (as root):

# chgrp psacln php-bin/php-cgi

???
PROFIT!!
 
Back
Top