Bug #73313 [Com]: over fpm does not respect in .user.ini engine off directive

From: Date: Sat, 30 Jul 2022 13:11:00 +0000
Subject: Bug #73313 [Com]: over fpm does not respect in .user.ini engine off directive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242084@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73313&edit=1 ID: 73313 Comment by: wbe7djjw at anonaddy dot me Reported by: vladimir at helesic dot cz Summary: over fpm does not respect in .user.ini engine off directive Status: No Feedback Type: Bug Package: FPM related Operating System: all PHP Version: Irrelevant Assigned To: bukka Block user comment: N Private report: N New Comment: I'm also trying to use this, simply as a defense-in-depth measure. I have a static directory that contains user uploads, and I would like to turn off PHP parsing within - in case a user manages to sneak a .php file in there. Of course, the proper way to do this would be to edit the server configuration, but: a) I have no access to this, as I'm on a shared hosting setup that is graciously provided to me. b) Even if I did, I would still like the additional insurance, in case the server configuration gets messed up somehow. What actually happens with engine=Off is immaterial I think, at least for this use case. I don't really want anything *to* happen, I just want PHP to *not* happen. I'm currently using a hack workaround where I use .user.ini to set auto_prepend_file to a script containing only '<?php exit;', but I tried engine=Off at first and was surprised when it did not work. Previous Comments: ------------------------------------------------------------------------ [2022-01-02 04:22:08] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. ------------------------------------------------------------------------ [2021-12-19 14:04:10] bukka@php.net But what should happen if there's 'engine=off'? Please note that FPM handles only FastCGI requests and it doesn't server files. For each request it uses engine and that's the only things that it can do with some exceptions like status and ping. Basically it's not a web server. That's why 'engine=off' makes sense only in Apache context that can actually do other things like serving files directly to user. It seems to me that you really need access to nginx to be able to do what you want unless I'm misunderstanding it..? ------------------------------------------------------------------------ [2021-12-19 00:11:12] pb at webjoker dot net Sorry for rambling, just saying that engine = Off seems like a neat security feature and it sucks that it does not work everywhere. OTOH, it will be bad when people assume that it works everywhere and rely on it exclusively, because even if I convinced you to add it, at least in old versions it would not work. ------------------------------------------------------------------------ [2021-12-19 00:06:36] pb at webjoker dot net "It doesn't really make any sense for FPM because it doesn't have any use without engine..." Hm, interesting. I want to create a little WordPress plugin that generates .user.ini files with memory_limit and I want to use it to add engine = Off to upload directories (e.g. contact form uploads). It is a shame that this does not (always) work, and when using nginx there is no way to do it unless I have access to the nginx configuration (not always the case). ------------------------------------------------------------------------ [2021-12-02 22:54:18] bukka@php.net This is only Apache configuration - see https://www.php.net/manual/en/apache.configuration.php#ini.engine It doesn't really make any sense for FPM because it doesn't have any use without engine... ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=73313 -- Edit this bug report at https://bugs.php.net/bug.php?id=73313&edit=1

« previous php.bugs (#242084) next »