• 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 Plesk site preview wants to download file

NicJD

New Pleskian
Hi

We are in the process of transferring our sites onto a new server. Before we switch the DNS we need to preview the sites to make sure all is working correctly....This works fine for most of the domains, but there is just one domain we can't preview, whenever we click the "preview site" button we are presented with a dialogue box saying:

"You have chosen to open:
which is: application/x-httpd-php (1.6kb)"

We have tried various things
- adding a .htaccess file
- followed the information on these links:
Resolved - One domain downloads php files instead of executing them
PHP pages are downloaded if PHP-FPM is used
- changed the PHP version, etc

On the existing server the site is running on PHP 5.4.22, on the new server we don't seem to have this option but have tried PHP 5.4.16, 5.4.45, along with more up to date versions.

But have had no luck.


In the process of trying to fix this problem we also followed this solution:
Apache handler is not available in Plesk: The handler cannot be enabled because corresponding Apache module turned off
But now we are unable to undo this process, and get the following errors:
"Apache Web Server Settings
Error: Unable to turn off the Apache PHP5 module: it is used by domains."
"Apache Web Server Settings
Error: Unable to set the mpm_event mode: it requires Apache PHP5 module turned off but this module is used by domains."


I'd really appreciate any help with this.

Many Thanks
 
The site preview is using the PHP version that is configured for the website, not the OS vendor PHP version.

Please check whether you are using an .htaccess file. Some users have a handler directive in that file that is pointing to some PHP handler that does not exist on the server. It is not necessary to have such directives in that file. Remove them, if there are any.

Further, make sure that you are either not using short open tags "<?" (instead, use <?php) or to turn short open tags "on" in the PHP configuration settings.
 
Thanks for your reply Peter, there is no .htaccess file now as we tried it and it didn't work, so we deleted it again.

I will check into the open tags and turn short open tags on anyway, as I believe some of the files do have the short PHP version.

The good news is we've had a bit of a break through tonight, something really basic that we overlooked! When we were making these changes and testing them in the browser we never thought to clear the browser cache... we have cleared the cache and the site preview is now working. So obviously one of the things we tried on my original post worked.

I'm guessing that the Apache Web Server settings that we modified and can't undo won't cause a problem?
 
Back
Top