Report this

What is the reason for this report?

php-fpm security.limit_extension issue

Posted on March 16, 2015

I run Nginx + php5-fpm with Ajenti on Debian. This is the issue error.log gives me on one of the websites:

2015/03/16 10:44:03 [error] 1487#0: *95 FastCGI sent in stderr: “Access to the script ‘/srv/test/index.php/author-login’ has been denied (see security.limit_extensions)” while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: xxx.xx, request: “GET /index.php/author-login HTTP/1.1”, upstream: “fastcgi://unix:/var/run/ajenti-v-php-fcgi-test2-php-fcgi-0.sock:”, host: “xxx.xxx”, referrer: “xxx.xxx

How can I repair security.limit_exceptions?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
0
Pinned Answer

Heya,

In case anyone else stumlbes upon the questions years later here is a summary of the problem and solution

The security.limit_extensions setting in PHP-FPM configuration is used to limit which PHP scripts are allowed to run, based on their file extension. By default, it only allows .php files to be executed. This security measure prevents malicious or unintentional execution of non-PHP files.

The error message you’re seeing suggests that you’re trying to access a URL that appears to have a path appended to the PHP file (index.php/author-login). From the perspective of PHP-FPM, this looks like a file named index.php/author-login, which doesn’t match the .php file extension, hence the error.

To resolve this issue, you have two options:

  1. Modify your application’s URL structure: The preferred solution is to change your URL structure so that PHP scripts do not have paths appended. For example, use URL parameters (index.php?page=author-login) or URL rewriting instead.

  2. Adjust the security.limit_extensions setting: While less preferred for security reasons, you could technically adjust the security.limit_extensions setting to allow this type of request. This option should be used with caution as it can create security risks.

If you’re sure you want to take the second option, you can do this by editing the PHP-FPM pool configuration file for your site. This file is usually located in the /etc/php/8.0/fpm/pool.d/ directory (replace 8.04 with your PHP version). In the pool configuration file (something like www.conf), you’ll find the line:

security.limit_extensions = .php

To allow URLs with paths appended to PHP files, you could change it to:

security.limit_extensions = .php / 

This allows any file that ends with .php or / to be executed as a PHP script. However, again, be aware that this may have security implications, especially if your server ever encounters a situation where non-PHP files could be interpreted as having these extensions.

After making changes, you’ll need to reload or restart the PHP-FPM service to apply the changes:

sudo systemctl reload php8.0-fpm

Remember to replace 8.0 with your PHP version.

Using PHP-FPM

If If i set

cgi.fix_pathinfo=0

Then i get an access denied message from owncloud. And could not make it work by uncommenting

security.limit_extensions = .php .php3 .php4 .php5 .php7

So i had to go back to cgi.fix_pathinfo=1

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.