[CentOS] Systemd, PHP-FPM, and /cgi-bin scripts

Benjamin Smith

lists at benjamindsmith.com
Wed Apr 24 06:37:51 UTC 2019


CentOS 7 server and Fedora 29 dev workstation, both with PHP 7.2, Apache 2.4, 
php-fpm, all updated. 

I have a web-based app I've been developing for some time, and recently the 
need to upload files of large size EG 1 GB or larger, has come up. 

So I wrote a /cgi-bin script that works, takes the input, and even runs the 
same application framework as the main application which normally works in 
php-fpm. (which also works in a shell script so it wasn't hard)  So /path/to/
webroot/cgi-bin/upload.php works just fine running as a separate process as a 
cgi executable. Yay! 

But... php-fpm has its own "tmp" directory, something like /tmp/systemd-
private-RANDOM-php-fpm.service-RANDOM/tmp that the cgi-bin has no access to. 
To be able to populate $_FILES in a way compatible with the rest of the 
framework, it appears that I need to be able to run the /cgi-bin in the same 
context as the php-fpm environment so files can be access across all the 
different parts of the web app. This includes related things like access to 
the $_SESSION data files, and so on. 

How do I even begin? Google searches are loaded with stuff like perl cgis 
having access to PHP data, PRE-SYSTEMD, and I find no apache directives (so 
far) that have been helpful. 

Any ideas? 




More information about the CentOS mailing list