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.
/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.
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
But 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:
4. Put info.php in "httpdocs/sub" folder in order to verify the version (optional):
Using the instruction above you can manage version of PHP for the subfolder by changing the version of PHP for the subdomain php.example.com
We need this because we have different things in our directories which require different versions of php.
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!
Great feature and very useful for developers and customer with diffrents app in domain.
A very important and useful feature.
we need it please
Mark lane commented
I too vote for this suggestion.
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.
Must availability this because, this feature has negative score for plesk
Я хочу иметь такую функцию
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?
Gab T commented
This is a must have feature. A very common usage of this is when we have a corporate website and we want to host an eshop in a subdirectory for SEO purposes instead of a subdomain.
If we have different platforms for website and eshop it could impose restrictions. For example main website is old and needs php5.3 and shop will require php 7.
In CPanel it's possible already by using an .htaccess rule like
AddHandler application/x-httpd-php56 .php5 .php4 .php .php3 .php2 .phtml
which is really versatile but it would be best if a GUI was available too. Sites using such setups are impossible to host in Plesk at the moment.
This would be great!