• 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.

Resolved On a subdomain in Plesk, PHP files are downloaded and not executed - how to fix?

Alexander Liebrecht

Basic Pleskian
Hello Plesk Community,

You are my last chance to solve my problem with a subdomain in Plesk. I reinstalled Centos 7 and Plesk 12.5. In the root directory under /var/www/vhosts/liebrecht-projekte.de/httpdocs is a Wordpress installation, which also works.

On the newly created subdomain at https://phabricator.liebrecht-projekte.de the PHP files are not executed, but only downloaded in the browser. I understand it so that PHP on the subdomain is not activated or something is missing in Linux with me.

Wordpress blog works great, but PHP does not work on a subdomain with PHP 5.6.

Has anyone an idea how I can solve the problem. Honestly, I am just a Centos / Linux novice and have few experiences. I would like to collect them.

Thanks in advance.
 
What PHP handled do you use for this subdomain? Have you tried to switch it to another? Have you tried to reconfigure subdomain settings with

# plesk repair web phabricator.liebrecht-projekte.de
 
Hi Igor,

Thank you for the hint. I have really tried everything and try to install the Phabricator Tool at http://portfolio.liebrecht-projekte.de.

I tried all the handlers, without success. As soon as I insert these lines code in the httpd.conf of the subdomain, the PHP files are downloaded again in the browser. Now I have PHP 5.4.16 and Apache handler.

If I insert this code under /etc/httpd/httpd.conf, it is not enough for this VirtualHost. So I do not know what else I can do. PHP does not go to this subdomain.

But in the subdirectory I could install a forum well and all PHP files were executed. Strange or ?!

Here is the code.

Code:
           DocumentRoot /var/www/vhosts/liebrecht-projekte.de/httpdocs/phabricator/webroot
RewriteEngine on
RewriteRule ^/rsrc/(.*) - [L,QSA]
RewriteRule ^/favicon.ico - [L,QSA]
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]

<Directory /var/www/vhosts/liebrecht-projekte.de/httpdocs/phabricator/webroot>
Order allow,deny
Allow from all
</Directory>
 
I don't see how your configuration matches your description. You first said, you want to use a subdomain phabricator.liebrecht-projekte.de, then you said that you want to install it in portfolio.liebrecht-projekte.de, but the web server configuration indicates that you are doing neither, because there you have created a subdirectory to liebrecht-projekte.de (your main domain) and are changing the rewrite configuration of your main domain instead of a subdomain.

I suggest to first complete these steps to ensure that you are starting from a defined, correct environment:

1) If you place a subdomain inside a main domain, an .htaccess file in the main domain level will influence the behavior of descending directories. That might be causing the strange behavior that some files are executed as .php code while others are downloaded only. You do not want that. You want a subdomain directory only for your subdomain, so that you have full control over what is going on in that subdomain. Create a subdomain in Plesk. Do not place it in a subdirectory of your main domain, but choose the default /subdomain folder and expand /phabricator/webroot to it (a suggestion by Phabricator installation instructions), so that your directory structure in your web space will be as follows.
/httpdocs (for the main domain liebrecht-projekte.de)
/phabricator.liebrecht-projekte.de/phabricator/webroot (for the subdomain where you want to install Phabricator)

2) Do NOT change the web server settings of the main domain.

3) Apply the changes to your Apache configuration of your SUBDOMAIN.
/* These two lines should already exist in the configuration, do not add these in the "additional Apache commands" section of Plesk, because they would only duplicate existing commands and probably cause issues: */
ServerName phabricator.liebrecht-projekte.de
DocumentRoot /var/www/vhosts/liebrecht-projekte.de/phabricator.liebrecht-projekte.de/phabricator/webroot
/* These lines can be added to the "additional Apache commands": */
RewriteEngine on
RewriteRule ^/rsrc/(.*) - [L,QSA]
RewriteRule ^/favicon.ico - [L,QSA]
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]

/* If your Apache version is older than 2.4: */
<Directory /var/www/vhosts/liebrecht-projekte.de/phabricator.liebrecht-projekte.de/phabricator/webroot>
Order allow,deny
Allow from all
</Directory>
/* If your Apache version is 2.4 or newer, the directory statement must be different: */
<Directory "/var/www/vhosts/liebrecht-projekte.de/phabricator.liebrecht-projekte.de/phabricator/webroot">
Require all granted
</Directory>

4) Wait for the web server to restart (wait for the restart interval to complete, see the Plesk confirmation message stating the interval), because Apache will only load the new configuration after that.

As an alternative - if you are unable to edit the Apache configuration file - you can omit step (3) and instead create an .htaccess file. See https://www.quora.com/How-do-you-set-up-Phabricator-on-Dreamhost for details on that.
 
Hi Peter,

You're just an ultra-awesome guy :) I've exactly followed your instructions and it worked out great. I just did not know I had to do it.

Plesk and Sudomain installations were a foreign world for me, but now I can also use this method to install Yabb forum and other CMS / forums.

Thank you so much for the quick and correct help.

I tried to actually put the DocumentRoot in the main domain and the PHP files were simply downloaded. In the official tutorials of Phabricator it is also said that the subdirectory will never work.

Now I'm in a good mood and can adjust Phabricator once. It only runs under PHP 5.

I would like to go back to this community if I have problems with Plesk.
 
Back
Top