Ability to set PHP version per directory inside the same webspace
A customer would like to be able to assign different PHP versions for different directories inside one the the same webspace.
For example,
/var/www/vhosts/example.com/httpdocs - php5.3.3
/var/www/vhosts/example.com/httpdocs/test - php5.2.17
/var/www/vhosts/example.com/httpdocs/test2 - php5.6.12
Thank you for your input. We will consider this functionality in upcoming releases, if it will be popular.
Everyone, please continue voting for this feature if you consider it important.
- SU
-
Anonymous commented
This is very important... Imagine this scenario: www.store.com (with php 7) and www.store.com/blog that needs php 8 or higher
-
Moazam commented
This feature was requested in 2015 and yet there is no implementation.
-
IngmarThiele commented
I could really use this feature when setting up a staging environment for our Shop system to pretest an upgrade. When i use a subdomain i have problems with the licenses for our bought plugins (should work fine under main domain).
I tried the following:
<FilesMatch ".(php4|php5|php3|php2|php|phtml)$">
SetHandler proxy:unix:///var/www/vhosts/system/php.example.com/php-fpm.sock|fcgi://127.0.0.1:9000
</FilesMatch>
which results in an error 503 (altered path, tried putting php8|php7| )
i also tried this suggestion but it doesnt change the PHP Version:
AddHandler application/x-httpd-php80 .php
AddHandler application/x-httpd-php56 .php5 .php4 .php .php3 .php2 .phtmlI tried both variants using a symlink or normal folder.
So now if i want to test the upgrade i have to change the main PHP resulting in the main shop to be not working any more.Using Plesk obsidian 18.0.36, can anyone explain this further?
-
Patrick commented
Makes still sense for upgrade path for software licensed based on the domainname.
-
Babis commented
This would be great, thank you.
-
darkf3d3 commented
There's still no updates about this feature?
I have multiple website under the same domain, one of them need an old php version and cannot be updated, so now I'm no more able to update wordpress version of the website into subfolder of this domain because of the old php version I'm using. -
Daniel Li commented
Another Use-Case would be to have a dev-System inside a subfolder so the dev-System can make use of the normal Domains, as there are Licensing systems which require a specific domain. Otherwise one would have to copy the System to a different server and assign the same domain to it, to see the dev-system one would have to change their hosts-file which is always a problem for inexperienced customers to do so. This Dev-System can be used to evaluate Updates which require a newer PHP Version while the Live-System might not be ready for the new PHP Version.
-
Aitor Fernandez commented
Hope this helps someone:
https://talk.plesk.com/threads/use-of-different-php-versions-in-different-folders.343416/#post-859025But yes, this should be built in...
-
Mark lane commented
So this is what i was able to get working with the help of plesk support's suggestion.
---
1. Let's assume you have a domain example.com with "httpdocs" set to vhost root folder and "httpdocs/sub" subfolder inside.
2. PHP set to PHP7.3 php-fpm server by Apache (PHP Settings):
3. Nginx used as a proxy for Apache (Apache and Nginx settings):
In order to enable a different version for PHP for "httpdocs/sub" please apply the following steps:
1. Create a subdomain "php.example.com"
2. Set PHP version to PHP7.1 PHP-FPM served by apache (select the version you need) for the subdomain in p1.
3. Put ".htaccess" file with the following content in "httpdocs/sub" folder:
<FilesMatch ".(php4|php5|php3|php2|php|phtml)$">
SetHandler proxy:unix:///var/www/vhosts/system/php.example.com/php-fpm.sock|fcgi://127.0.0.1:9000
</FilesMatch>
4. Put info.php in "httpdocs/sub" folder in order to verify the version (optional):
https://example.com/sub/info.phpUsing the instruction above you can manage version of PHP for the subfolder by changing the version of PHP for the subdomain php.example.com
-
Anonymous commented
We need this because we have different things in our directories which require different versions of php.
-
Leticia commented
Our customers would like to assign different versions of PHP to directories within the same domain. I vote to have this feature implemented in a future release. Thanks!
-
Anonymous commented
Great feature and very useful for developers and customer with diffrents app in domain.
-
Zameer commented
A very important and useful feature.
-
Anonymous commented
we need it please
-
Mark lane commented
I too vote for this suggestion.
-
Anonymous commented
I also think this is a must feature. In large websites there are always new websites in subfolders: blog, eshop, microsite...
I think that solution is to use nginx reverse proxy feature to serve another website.
-
Emre commented
Must availability this because, this feature has negative score for plesk
-
Anonymous commented
Я хочу иметь такую функцию
-
Gabriel T commented
@Sergey sorry for the long delay to respond. I was caught up in work and didn't have time to catch up here. What I mentioned for SEO is just a simple use-case based on statistics reports I gathered online. To be honest I don't understand how you suggest to configure virtual directories in this case to bypass this SEO issue. It would very interesting to see an implementation example to overcome this situation.
I also understand this would be a long-term commitment to implement this because it does seem really hard to do. But I do think it would also be a great asset for PLESK and worth investing the time and effort.
-
Thank you @Gab T for explaining the usage. It really helps to understand the reason behind a request to evaluate its priority
We will consider this, but cannot promise quick delivery. PHP version is tightly connected to website concept.
However, did you consider placing scripts in different site and configuring virtual directories in .htaccess for SEO needs? Can that help?