• 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 How to enable .sphp extension on Plesk

Nilton Santos

Basic Pleskian
Hello Everybody.

I have one question.

My cliente want to execute .sphp extension by browser.

How to enable .sphp extension on Plesk to execute on browser?
 
You need to add a handler to your Apache configuraton. This can be done either in the Apache configuration section of the Plesk GUI or in an .htaccess file. It should look like this, if it is based solely on the file extension

<FilesMatch "[^.]+\.sphp$">
SetHandler HANDLERNAME
</FilesMatch>

HANDLERNAME is the handler that you want the file to be processed by, for example cgi-script. I do not know the file extension .sphp, thus I don't know what handler this requires.

As an alternative you can add a MIME type handler in .htaccess like this example:

AddHandler application/HANDLERNAME .sphp

But again, you need to know what the HANDLERNAME must be replaced with for .sphp files.
 
Dear Support,

We are performing a migration of our own domain, that runs on a server with PHP 5.2, CentOS 5.11 and Apache / 2.2.3.

On the Production Server, we've executed scripts with extension .sphp.

The necessary settings for the operation, is to make the configuration in the file: /etc/httpd/conf.d/php.conf according to the follow configs:

#
# Cause PHP-CGI handle files with .sphp extension.
#
AddType application / x-httpd-wphp .sphp
Action application / x-httpd-wphp / cgi-bin / php-cgi

With these settings, the .sphp file runs on the production server.

How do we perform this configuration on our Plesk server?

We have a server in test environment and we don't get what is wrong with the plesk and the old system.

We have already migrated all content, however when performing tests in the .sphp script, he not executed, just performed the download of the file.

Additionally, we have already performed tests inserting the line:

"AddHandler application / x-httpd-wphp .sphp" in the .htaccess file and the add a MIME type handler, however, even if you make these settings, the content of the file are displayed in the browser instead of being executed like you can see below


Example:

Info.sphp is printed in the browser:

<?
Phpinfo ();
?>
 
Hello my friend Nilton Santos.

To resolve your customer's problem, try the following:

Through the Plesk Panel go to:
Domains > domain.tld > Apache & nginx Settigs

In "Additional directives for HTTP", paste the following lines:

<Files ~ (\.sphp$)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .sphp
Options +ExecCGI
</Files>

rafaelPlesk.png

I hope this can help you! :)
 
Hello Rafael,

This solution worked very well, that's exactly what we were looking for.

Thank you very much, my friend.

Congratulations.
 
Back
Top