From 9f2448ea8b2528dd79108242ac46f011eba80c82 Mon Sep 17 00:00:00 2001 From: Kamil Kaminski Date: Mon, 16 Jan 2023 15:24:31 -0600 Subject: tiny php fastcgi and fpm php5 configs --- tiny/etc/apache2/conf-available/php5_cgi.conf | 17 +++++++++ tiny/etc/apache2/conf-available/php5_fastcgi.conf | 32 +++++++++++++++++ .../php5_fastcgi_nonwrappercall.conf | 29 +++++++++++++++ tiny/etc/apache2/conf-available/php5_fcgid.conf | 42 ++++++++++++++++++++++ tiny/etc/apache2/conf-available/php5_fpm.conf | 8 +++++ 5 files changed, 128 insertions(+) create mode 100644 tiny/etc/apache2/conf-available/php5_cgi.conf create mode 100644 tiny/etc/apache2/conf-available/php5_fastcgi.conf create mode 100644 tiny/etc/apache2/conf-available/php5_fastcgi_nonwrappercall.conf create mode 100644 tiny/etc/apache2/conf-available/php5_fcgid.conf create mode 100644 tiny/etc/apache2/conf-available/php5_fpm.conf diff --git a/tiny/etc/apache2/conf-available/php5_cgi.conf b/tiny/etc/apache2/conf-available/php5_cgi.conf new file mode 100644 index 0000000..0d75024 --- /dev/null +++ b/tiny/etc/apache2/conf-available/php5_cgi.conf @@ -0,0 +1,17 @@ +# i don't think mod_cgi is meant for handling php, i fucking really dunno after shitload of time, +# but this was done for fun, fuck you +# +# maybe this only works for shebanged scripts e.g. pl py? + + + +# when below was on, http response header was "Content-Type: application/x-httpd-php" and prompted firefox to download the file +# AddType application/x-httpd-php .php + AddHandler cgi-script .php + DirectoryIndex index.php index.html + + SetHandler cgi-script + + + + diff --git a/tiny/etc/apache2/conf-available/php5_fastcgi.conf b/tiny/etc/apache2/conf-available/php5_fastcgi.conf new file mode 100644 index 0000000..982974a --- /dev/null +++ b/tiny/etc/apache2/conf-available/php5_fastcgi.conf @@ -0,0 +1,32 @@ +# +# with FastCgiWrapper I'm running into weird perm issue +# -> might need to look at suexec? +# + + + + DirectoryIndex index.php index.html + AddType application/x-httpd-php .php + AddHandler fastcgi-script .php + FastCgiWrapper /srv/http/cgi-bin/fastcgi-php-wrapper + + Options +FollowSymLinks +ExecCGI + + + Options +ExecCGI + + + + +# +# # chown -R http.http /srv/http/cgi-bin/ + +# cat /srv/http/cgi-bin/fastcgi-php-wrapper +# +# #!/usr/bin/env bash +# +# PHP_FCGI_MAX_REQUESTS=1000 +# export PHP_FCGI_MAX_REQUESTS +# +# exec /usr/bin/php-cgi + diff --git a/tiny/etc/apache2/conf-available/php5_fastcgi_nonwrappercall.conf b/tiny/etc/apache2/conf-available/php5_fastcgi_nonwrappercall.conf new file mode 100644 index 0000000..b94993d --- /dev/null +++ b/tiny/etc/apache2/conf-available/php5_fastcgi_nonwrappercall.conf @@ -0,0 +1,29 @@ + + AddHandler php-fastcgi .php + AddType application/x-httpd-php .php + DirectoryIndex index.php index.html + Action php-fastcgi /cgi-bin/fastcgi-php-wrapper + + # below SetHandler is not needed but nice for shebanged .sh or .pl scripts + SetHandler cgi-script + Options +FollowSymLinks +ExecCGI + + +# +# # with this i enable php via fastcgi server wide, might want to narrow it down to specific vhosts +# # SetHandler is am override, redundant here since AddHandler already registered .php extension +# SetHandler php-fastcgi +# # below probably redundant since it looks like only the wrapper needs this bit ON +# Options +ExecCGI +# + + + + +# almost worked, blew up on: +# +# mod_fastcgi: error reading data from FastCGI server +# [Sun Nov 30 01:00:59.663064 2014] [core:error] [pid 11886] [client ::1:46027] End of script output before headers: php-fastcgi-wrapper +# +# what a fucking joke + diff --git a/tiny/etc/apache2/conf-available/php5_fcgid.conf b/tiny/etc/apache2/conf-available/php5_fcgid.conf new file mode 100644 index 0000000..a3bac7b --- /dev/null +++ b/tiny/etc/apache2/conf-available/php5_fcgid.conf @@ -0,0 +1,42 @@ +# +# (1) the /cgi-bin needs its uid and gid to be owned by http! otherwise infinite strange loop occurs +# (2) the following error: mod_fcgid: error reading data from FastCGI server, End of script output before headers: hello.cgi +# -> it can be fixed by changing back to "AddHandler cgi-script .cgi", but I don't want that, I want fastcgi +# -> the "End of script output before headers: fastcgi-php-wrapper" actually happened when fastcgi-php-wrapper was using 'php-cgi' +# that did not exist on my system, therefore that wrapper script ENDED/PRINTED (nothing) before HEADERS (because headers never were sent back!) +# -> this might mean that mod_fcgid/mod_fastcgi need wrappers for all file extensions, e.g. spawn /bin/bash for .sh, spawn php-cgi for .php, etc. +# +# - look like there are 2 ways to spawn wrappers, (1) via FcgidWrapper or FastCgiWrapper and (2) via new 'AddHandler' and 'Action' +# - to verify fastcgi is used use phpinfo() and look for "Server API = CGI/FastCGI" +# - php_admin_value directive is not available in cgi mode! +# + + + AddHandler php-fcgid .php + AddType application/x-httpd-php .php + DirectoryIndex index.php index.html + Action php-fcgid /cgi-bin/fastcgi-php-wrapper + + # below SetHandler is not needed but nice for shebanged .sh or .pl scripts + SetHandler cgi-script + Options +FollowSymLinks +ExecCGI + + +# +# # with this i enable php via fastcgi server wide, might want to narrow it down to specific vhosts +# # SetHandler is am override, redundant here since AddHandler already registered .php extension +# SetHandler php-fcgid +# # below probably redundant since it looks like only the wrapper needs this bit ON +# Options +ExecCGI +# + + + + +# almost worked, blew up on: +# +# mod_fcgid: error reading data from FastCGI server +# [Sun Nov 30 01:00:59.663064 2014] [core:error] [pid 11886] [client ::1:46027] End of script output before headers: php-fcgid-wrapper +# +# what a fucking joke + diff --git a/tiny/etc/apache2/conf-available/php5_fpm.conf b/tiny/etc/apache2/conf-available/php5_fpm.conf new file mode 100644 index 0000000..1ebf27d --- /dev/null +++ b/tiny/etc/apache2/conf-available/php5_fpm.conf @@ -0,0 +1,8 @@ +AddType application/x-httpd-php .php + + SetHandler fcgi://localhost:9011/srv/http/ + + + DirectoryIndex index.php index.html + + -- cgit v1.2.3