Configure PASE FastCGI Support for PHP Processing
The following two files are used to configure PASE FastCGI support for PHP processing on IBM HTTP Server on i:
- IBM HTTP Server (powered by Apache) instance configuration file (httpd.conf)
- A FastCGI configuration file (fastcgi.conf)
Both configuration files need to exist in the same configuration directory as your IBM HTTP Server instance configuration file.
For example:
/www/myserver/conf/httpd.conf
/www/myserver/conf/fastcgi.conf
Edit your IBM HTTP Server Instance Configuration File
To edit your IBM HTTP Server instance configuration file using the IBM Web Administration of i GUI using the following steps:
- Bring up the IBM Web Administration for i GUI on port 2001 using a web browser.
- Sign in using a valid IBM i profile and password.
- Click the Manage tab.
- Click the HTTP Servers sub-tab.
- Select your IBM HTTP Server instance from the Server drop down list.
- Expand Tools.
- Click Edit Configuration File
- Add the following PASE FastCGI program (module):
LoadModule zend_enabler_module /QSYS.LIB/QHTTPSVR.LIB/QZFAST.SRVPGM - Associate the .php file extension with the application/x-httpd-php MIME type AddType application/x-httpd-php .php
- Specify the fastcgi-script handler for PHP
AddHandler fastcgi-script .php (for all files within the directive scope with a .php extension)
-or-
SetHandler fastcgi-script(for all files within the directive scope) - Click Apply.
- Click OK.
Create the FastCGI Configuration
To create the FastCGI configuration file using an editor of your choosing. Here is how to create it using Qshell:
For example:
QSYS/QSH CMD('/usr/bin/touch -C 819 /www/myserver/conf/fastcgi.conf')
Note:
The fastcgi.conf file needs to be in CCSID 819 (ASCII).
Edit the FastCGI Configuration File
To edit the FastCGI configuration file so it contains only two lines as follows:
Line 1:
Server type="application/x-httpd-php" CommandLine="/usr/local/zendphp7/bin/php-cgi.bin" StartProcesses="1" SetEnv="LIBPATH=/usr/local/zendphp7/lib" SetEnv="PHPRC=/usr/local/zendphp7/etc/" SetEnv="PHP_FCGI_CHILDREN=5" SetEnv="PHP_FCGI_MAX_REQUESTS=0" ConnectionTimeout="30" RequestTimeout="60" SetEnv="CCSID=819" SetEnv="LANG=C" SetEnv="INSTALLATION_UID=100313092601" setEnv=="LDR_CNTRL=MAXDATA=0x40000000"
SetEnv=="ZEND_TMPDIR=/usr/local/zendphp7/tmp SetEnv="TZ=<EST>-5"
Note:
This must all be on a single line within file fastcgi.conf. You may have multiple servers, one per line
Line 1: Parameter Information |
||
Parameter Name |
Description |
Recommended Value |
Server type |
Needs to match the MIME type specified on directive AddType in file httpd.conf. |
|
CommandLine |
PASE FastCGI program name |
|
StartProcesses |
Monitor/Start PASE FastCGI worker jobs |
“1” |
SetEnv |
Sets an environment variable |
|
PHP_FCGI_CHILDREN |
Number of FastCGI worker jobs |
|
PHP_FCGI_MAX_REQUESTS |
Number request before worker job recycles |
0 never recycle or a large number to avoid job start/stop |
Optional: SetEnv Lang/CCSID |
Control FastCGI Lang/CCSID |
Specify both or none. These settings will override the FastCGI Language default line. |
FastCGI language |
en_US |
|
CCSID |
FastCGI CCSID |
819 (or 1208) |
ConnectionTimeout |
Number of seconds before web server receives timeout |
|
RequestTimeout |
Number of seconds before running PHP script receives timeout |
For additional language codes see National Language Support.
Line 2:
IpcDir /www/<server instance>/logs
where <server instance> is your server instance name
Note:
This IpcDir line must all be on a single line within file fastcgi.conf.
Line 2: Parameter Information |
||
Parameter Name |
Description |
Recommended Value |
IpcDir |
Is used to create the FastCGI sockets file. Note the specified directory must be file read/write capable by the Web server. |
Line 3 (optional):
Language LANG=en_US CCSID=819
Note:
This must all be on a single line within file fastcgi.conf.
Line 3: Parameter Information |
||
Parameter Name |
Description |
Recommended Value |
Language |
Default language and CCSID for all servers |
|
FastCGI default language |
C |
|
CCSID |
FastCGI default CCSID |
819 or 1208 |
For additional language codes see National Language Support.
Restart Your IBM HTTP Server Instance
To restart your IBM HTTP Server instance using either start/stop Apache option in Zend Server Setup menu or PHP Restart button in the Zend Server Administration interface.
Note:
It is possible to use IBM commands to restart your IBM HTTP Server instance using either the Zend Server Setup Menu ENDTCPSVR/STRTCPSVR commands, or the IBM Web Administration for IBM i.