• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved PHP files are downloaded in Apache for a single domain - PHP is enabled

Aileron79

New Pleskian
Hi everybody,
I have running many PHP sites on my Plesk server, however, a single one just keeps on offering PHP-files for download instead of executing them. The landing page Example Domain loads perfectly and prints something like "Forwarding to login page". After a few seconds, the index.php File downloads. I created a simple phpinfo.php page <? phpinfo(); that when opened via https://www.example.com/phpinfo.php also is offered for download (containing the original php code) instead of being executed.

In Plesk I can choose from various PHP 7.2 versions, it works with FPM via nginx. However, FPM via Apache or FCGI via Apache just allows me to download the files. PHP support is enabled of course. Other domains, even for the same customer, using the very same settings work perfectly fine.

I have reinstalled the fcgi packages, restarted Apache numerous times, updated the Plesk packages as it was suggested in various other threads but still, Apache and PHP7 just don't work together for a single domain.

I've tried these as well without success:
PHP files are downloaded instead of executing
Resolved - One domain downloads php files instead of executing them

I'd appreciate any suggestions on how to proceed...
 
Please try to start your tag with
<?php
instead of
<?
If you have "short_open" tags disabled, code won't be executed by printed out. In your phpinfo() example you started your code with "<?", so it is thinkable that this is the simple solution.
 
Thanks for your suggestion, however, that's not the issue, it does not work either way. There are no error messages at all in any log file. And also the phpinfo test file works perfectly fine in any other domain.

As mentioned earlier, the funny thing is that index.php loads fine as a landing page (so by just opening the domain), but it does not when explicitly opened (by adding /index.php to the domain name in the browser's address bar).

For testing purposes, I renamed the original index.php to something different and replaced it with my phpinfo test script. The behavior is the same, just opening http:// www.example.com works fine, i get the phpinfo page. Opening http://www.example.com/index.php does not work, the file is offered for download and contains the phpinfo script.

I restarted the apache service as well as the browser (private browsing to avoid caching issues), same thing, nothing changed. I also tried different browsers and removed the .htaccess file to make sure it does not cause these issues.

Please advise.
 
Last edited:
- Do you have any additional Apache or Nginx directives in the "Apache and nginx settings" section or is all there empty and/or default?
- Some users have an .htaccess file where they enter PHP handler directives. Does the domain have such a file?
 
Think Peter nailed it with the PHP handler suggestion. Check the .htaccess file, if nothing is in there, try changing the domain to a different PHP handler to troubleshoot.
 
it was a browser "bug" in inconitio modus the error was gone. but in my normal browser session the bug was consistent.

i think it was caused by mising php-fastcgi ... i'm not really sure.
 
Back
Top