In most Apache and mod_php setups, .phps are not executed as php files, but are rather passed to mod_php which highlights them as PHP code and displays them to the browser.
When I switched to Nginx, I still wanted to share php files that way. A quick and easy way to "fix" that is as follows:
Example: info.phps
The whole thing is made out of 1 file: phps.php
Once you download that file:
- Put it in a directory that has a recursive o+x (all its parents have o+x)
- Chown the files to you:you
- Chmod the files 664
All that is left now is the Nginx configuration:
location ~ \.phps$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SCRIPT_NAME $uri;
fastcgi_param SCRIPT_FILENAME /path/to/phps.php;
include fastcgi_params;
}
And you are done! Rehash Nginx and voila!