Skip to main content

HI
I am working on a operating system Z/OS v2r2
Http server is installed and is correct on my lpar.

/etc/webap1/bin/apachectl -v

Server
version: IBM_HTTP_Server/9.0.0.0-PI54808 (Unix) Server
built: Jan 20 2016 17:19:40

Php is the tool of Rocket and is installed in :
/PRODUITS/ROCK/php
EUID=0
/PRODUITS/ROCK/php/
Type Filename
_,Dir
,.
_,Dir
,…
_,Dir ,bin
_,Syml ,CHANGES.ZOS
_,File ,fichier.php544.tar
_,Dir ,include
_,Dir ,lib
_,Dir ,man
_,File ,README
_,Syml ,README.ZOS
_,Dir ,share
_,Syml ,VERSION.ZOS

/PRODUITS/ROCK/php/bin/php -v
PHP 5.4.4 (cli) (built: Nov 21 2016 03:25:49)
Copyright © 1997-2012 The PHP Group
Zend Engine v2.4.0,
Copyright © 1998-2012 Zend Technologies

I made the export in the .profile of the user of the stc. (start server Apache)

export PATH=$PATH:/PRODUITS/ROCK/php/bin
export MANPATH=$MANPATH:/PRODUITS/ROCK/php/man/

When I want to see my page html, the command (php) are not interpreted.

Html page :

Standard HTML Page with PHP HelloWorld <?PHP print "Hello World"; print "
Generated with PHP"; ?>

Browser result :

Generated with PHP"; ?>.

I am looking for a installation guide and customization : Apache server z/OS and php ?
Can you help me ?
Best regards

HI
I am working on a operating system Z/OS v2r2
Http server is installed and is correct on my lpar.

/etc/webap1/bin/apachectl -v

Server
version: IBM_HTTP_Server/9.0.0.0-PI54808 (Unix) Server
built: Jan 20 2016 17:19:40

Php is the tool of Rocket and is installed in :
/PRODUITS/ROCK/php
EUID=0
/PRODUITS/ROCK/php/
Type Filename
_,Dir
,.
_,Dir
,…
_,Dir ,bin
_,Syml ,CHANGES.ZOS
_,File ,fichier.php544.tar
_,Dir ,include
_,Dir ,lib
_,Dir ,man
_,File ,README
_,Syml ,README.ZOS
_,Dir ,share
_,Syml ,VERSION.ZOS

/PRODUITS/ROCK/php/bin/php -v
PHP 5.4.4 (cli) (built: Nov 21 2016 03:25:49)
Copyright © 1997-2012 The PHP Group
Zend Engine v2.4.0,
Copyright © 1998-2012 Zend Technologies

I made the export in the .profile of the user of the stc. (start server Apache)

export PATH=$PATH:/PRODUITS/ROCK/php/bin
export MANPATH=$MANPATH:/PRODUITS/ROCK/php/man/

When I want to see my page html, the command (php) are not interpreted.

Html page :

Standard HTML Page with PHP HelloWorld <?PHP print "Hello World"; print "
Generated with PHP"; ?>

Browser result :

Generated with PHP"; ?>.

I am looking for a installation guide and customization : Apache server z/OS and php ?
Can you help me ?
Best regards

Hi

The common configuration:
/path/to/php/ - the path at PHP directory
Change this path below on your.

Add the following lines to httpd.conf:

ScriptAlias /php/ "/path/to/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php “/php/bin/php-cgi”

Open php.ini and change cgi.fix_pathinfo to zero:

cgi.fix_pathinfo=0

The path to load php.ini in .bashrc:

export PHPRC=_/path/to/php/_bin
(Probably, better to put php.ini in _/path/to/php/_bin/)

If you have not only PHP files include HTML text, you have the files with another extension (’.html’, for example) that includes PHP, you may also add this extension at the following directive:

AddType application/x-httpd-php .php .html

Please, let me know if you have additional questions.

Thanks,
Sergey


HI
I am working on a operating system Z/OS v2r2
Http server is installed and is correct on my lpar.

/etc/webap1/bin/apachectl -v

Server
version: IBM_HTTP_Server/9.0.0.0-PI54808 (Unix) Server
built: Jan 20 2016 17:19:40

Php is the tool of Rocket and is installed in :
/PRODUITS/ROCK/php
EUID=0
/PRODUITS/ROCK/php/
Type Filename
_,Dir
,.
_,Dir
,…
_,Dir ,bin
_,Syml ,CHANGES.ZOS
_,File ,fichier.php544.tar
_,Dir ,include
_,Dir ,lib
_,Dir ,man
_,File ,README
_,Syml ,README.ZOS
_,Dir ,share
_,Syml ,VERSION.ZOS

/PRODUITS/ROCK/php/bin/php -v
PHP 5.4.4 (cli) (built: Nov 21 2016 03:25:49)
Copyright © 1997-2012 The PHP Group
Zend Engine v2.4.0,
Copyright © 1998-2012 Zend Technologies

I made the export in the .profile of the user of the stc. (start server Apache)

export PATH=$PATH:/PRODUITS/ROCK/php/bin
export MANPATH=$MANPATH:/PRODUITS/ROCK/php/man/

When I want to see my page html, the command (php) are not interpreted.

Html page :

Standard HTML Page with PHP HelloWorld <?PHP print "Hello World"; print "
Generated with PHP"; ?>

Browser result :

Generated with PHP"; ?>.

I am looking for a installation guide and customization : Apache server z/OS and php ?
Can you help me ?
Best regards

Hello
I also have some difficulty to get php running on z/OS.
I’ve installed php on a different PATH as Default -> /php
I’ve just ran following command on my OMVS:
/php/bin/php-cgi --php-ini /etc/ihsapach/cgi-bin/php/php.ini /etc/ihsapach/cgi-bin/php/myphp.php
Status: 404 Not Found
X-Powered-By: PHP/5.4.4
Content-type: text/html

No input file specified.

I’ve set cgi.fix_pathinfo=0 within php.ini and myphp.php looks very simple:

My first PHP page

<?php echo "Hello World!"; ?>

I see within /php/bin/php-config the default paths and I’m not sure if this could influence my problem?

Any help is highly appreciated.

thx, Patrik


HI
I am working on a operating system Z/OS v2r2
Http server is installed and is correct on my lpar.

/etc/webap1/bin/apachectl -v

Server
version: IBM_HTTP_Server/9.0.0.0-PI54808 (Unix) Server
built: Jan 20 2016 17:19:40

Php is the tool of Rocket and is installed in :
/PRODUITS/ROCK/php
EUID=0
/PRODUITS/ROCK/php/
Type Filename
_,Dir
,.
_,Dir
,…
_,Dir ,bin
_,Syml ,CHANGES.ZOS
_,File ,fichier.php544.tar
_,Dir ,include
_,Dir ,lib
_,Dir ,man
_,File ,README
_,Syml ,README.ZOS
_,Dir ,share
_,Syml ,VERSION.ZOS

/PRODUITS/ROCK/php/bin/php -v
PHP 5.4.4 (cli) (built: Nov 21 2016 03:25:49)
Copyright © 1997-2012 The PHP Group
Zend Engine v2.4.0,
Copyright © 1998-2012 Zend Technologies

I made the export in the .profile of the user of the stc. (start server Apache)

export PATH=$PATH:/PRODUITS/ROCK/php/bin
export MANPATH=$MANPATH:/PRODUITS/ROCK/php/man/

When I want to see my page html, the command (php) are not interpreted.

Html page :

Standard HTML Page with PHP HelloWorld <?PHP print "Hello World"; print "
Generated with PHP"; ?>

Browser result :

Generated with PHP"; ?>.

I am looking for a installation guide and customization : Apache server z/OS and php ?
Can you help me ?
Best regards

Hi,

“PHP-CGI” is for WEB Server in “CGI” or “Fast CGI” mode.
To run from OMVS (or JCL) try “PHP”.

//J000000T JOB ,'PHP',CLASS=W,MSGCLASS=H,NOTIFY=&SYSUID            
//*                                                                
//* run php script                                                 
//*                                                                
//PHPPGM   SET PHPPGM='/sysplex/produit/php/bin/php' * PHP "CLI"   
//PHPINI   SET PHPINI='/local/basepro/php'           * php.ini path
//*                                                                
//PHP      EXEC PGM=BPXBATCH,                                      
//  PARM='sh &PHPPGM -c &PHPINI --help'                            
//STDOUT   DD SYSOUT=*                                             
//STDERR   DD SYSOUT=*                                             
//STDIN    DD DUMMY                                                
//STDPARM  DD DUMMY                                                

PHP-HELP.pdf (27,0 Ko)

//J000000T JOB ,'PHP',CLASS=W,MSGCLASS=H,NOTIFY=&SYSUID                 
//*                                                                     
//* run php script                                                      
//*                                                                     
//SYMBOLS  EXPORT SYMLIST=(PHPPGM,PHPINI,SCRIPT)                        
//*                                                                     
//PHPPGM   SET PHPPGM='/sysplex/produit/php/bin/php' * PHP "CLI"        
//PHPINI   SET PHPINI='/local/basepro/php'           * php.ini folder   
//SCRIPT   SET SCRIPT='/local/basepro/m4stats/phpinfo.php'              
//*                                                                     
//PHP      EXEC PGM=BPXBATCH                                            
//STDOUT   DD SYSOUT=*                                                  
//STDERR   DD SYSOUT=*                                                  
//STDIN    DD DUMMY                                                     
//STDPARM  DD *,SYMBOLS=(JCLONLY)                                       
sh &PHPPGM                                                              
-c &PHPINI                                                              
-i -m -v                                                                
&SCRIPT                                                                 
/*                                                                       

PHPINFO.pdf (101,6 Ko)

VIEW       /local/basepro/m4stats/phpinfo.php   
Command ===>                                    
****** *****************************************
000001 <?php                                    
000002 phpinfo();                               
000003 ?>                                       
****** *****************************************

Regards,

Denis


Hi,

“PHP-CGI” is for WEB Server in “CGI” or “Fast CGI” mode.
To run from OMVS (or JCL) try “PHP”.

//J000000T JOB ,'PHP',CLASS=W,MSGCLASS=H,NOTIFY=&SYSUID            
//*                                                                
//* run php script                                                 
//*                                                                
//PHPPGM   SET PHPPGM='/sysplex/produit/php/bin/php' * PHP "CLI"   
//PHPINI   SET PHPINI='/local/basepro/php'           * php.ini path
//*                                                                
//PHP      EXEC PGM=BPXBATCH,                                      
//  PARM='sh &PHPPGM -c &PHPINI --help'                            
//STDOUT   DD SYSOUT=*                                             
//STDERR   DD SYSOUT=*                                             
//STDIN    DD DUMMY                                                
//STDPARM  DD DUMMY                                                

PHP-HELP.pdf (27,0 Ko)

//J000000T JOB ,'PHP',CLASS=W,MSGCLASS=H,NOTIFY=&SYSUID                 
//*                                                                     
//* run php script                                                      
//*                                                                     
//SYMBOLS  EXPORT SYMLIST=(PHPPGM,PHPINI,SCRIPT)                        
//*                                                                     
//PHPPGM   SET PHPPGM='/sysplex/produit/php/bin/php' * PHP "CLI"        
//PHPINI   SET PHPINI='/local/basepro/php'           * php.ini folder   
//SCRIPT   SET SCRIPT='/local/basepro/m4stats/phpinfo.php'              
//*                                                                     
//PHP      EXEC PGM=BPXBATCH                                            
//STDOUT   DD SYSOUT=*                                                  
//STDERR   DD SYSOUT=*                                                  
//STDIN    DD DUMMY                                                     
//STDPARM  DD *,SYMBOLS=(JCLONLY)                                       
sh &PHPPGM                                                              
-c &PHPINI                                                              
-i -m -v                                                                
&SCRIPT                                                                 
/*                                                                       

PHPINFO.pdf (101,6 Ko)

VIEW       /local/basepro/m4stats/phpinfo.php   
Command ===>                                    
****** *****************************************
000001 <?php                                    
000002 phpinfo();                               
000003 ?>                                       
****** *****************************************

Regards,

Denis

Hi Denis

I’ve performed these Jobs:
//*
//* RUN PHP SCRIPT
//*
//PHPPGM SET PHPPGM=’/php/bin/php’ * PHP “CLI”
//PHPINI SET PHPINI=’/php’ * PHP.INI PATH
//*
//PHP EXEC PGM=BPXBATCH,
// PARM=‘SH &PHPPGM -c &PHPINI --help’
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDIN DD DUMMY
//STDPARM DD DUMMY
-> output looks same as your ones

As well the second one with your phpinfo.php:
//*
//* RUN PHP SCRIPT
//*
//PHPPGM SET PHPPGM=’/php/bin/php’ * PHP “CLI”
//PHPINI SET PHPINI=’/php’ * PHP.INI PATH
//SCRIPT SET PHPINI=’/etc/ihsapach/cgi-bin/php/phpinfo.php’
//*
//SYMBOLS EXPORT SYMLIST=(PHPPGM,PHPINI,SCRIPT)
//

//PHP EXEC PGM=BPXBATCH,
// PARM=‘SH &PHPPGM -c &PHPINI -i -m -v &SCRIPT’
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDIN DD DUMMY
//STDPARM DD DUMMY
PHPINFO.pdf (36.9 KB)

But I get RC 3840

As well if I call phpinfo.php within Apache
http://141.171.36.169/php/phpinfo.php
I get -> No input file specified.

So somewhere I’ve missed a customizing step. I see a lot of inst. docs for different platform but not for z/OS.

Thx, Patrik


Hi Denis

I’ve performed these Jobs:
//*
//* RUN PHP SCRIPT
//*
//PHPPGM SET PHPPGM=’/php/bin/php’ * PHP “CLI”
//PHPINI SET PHPINI=’/php’ * PHP.INI PATH
//*
//PHP EXEC PGM=BPXBATCH,
// PARM=‘SH &PHPPGM -c &PHPINI --help’
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDIN DD DUMMY
//STDPARM DD DUMMY
-> output looks same as your ones

As well the second one with your phpinfo.php:
//*
//* RUN PHP SCRIPT
//*
//PHPPGM SET PHPPGM=’/php/bin/php’ * PHP “CLI”
//PHPINI SET PHPINI=’/php’ * PHP.INI PATH
//SCRIPT SET PHPINI=’/etc/ihsapach/cgi-bin/php/phpinfo.php’
//*
//SYMBOLS EXPORT SYMLIST=(PHPPGM,PHPINI,SCRIPT)
//

//PHP EXEC PGM=BPXBATCH,
// PARM=‘SH &PHPPGM -c &PHPINI -i -m -v &SCRIPT’
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDIN DD DUMMY
//STDPARM DD DUMMY
PHPINFO.pdf (36.9 KB)

But I get RC 3840

As well if I call phpinfo.php within Apache
http://141.171.36.169/php/phpinfo.php
I get -> No input file specified.

So somewhere I’ve missed a customizing step. I see a lot of inst. docs for different platform but not for z/OS.

Thx, Patrik

Hi

I did not manage to run PHP by direct call under IHS-Apache (I was there with IHS-GoDomino).
I was forced to set up “wrappers” to encapsulate the call to PHP in a bash script.
The bash script declares the environment variables (including PHPRC for the path to php.ini and DSNAOINI for the DB2 system).
The use of bash scripts also allows me to have different contexts (php.ini) by “Application”.
I have run two different implementations “CGI” and “FastCGI”. The simplest to implement is “CGI”:

  • AddType directive to associate the .php extension with the “application/x-httpd-php” type
  • AddHandler directive to associate the .php extension with a handler
  • Action directive to associate the manager with a bash script that must have the .cgi extension to be processed by the Apache module “mod_cgi.so”
  • the folder containing the bash script must be authorized at the CGI level
    The implementation details and sample bash script are given a bit higher in this conversation.

PHP configuration.pdf (52,1 Ko)
PHP FastCGI.pdf (628,2 Ko)
PHP CGI.pdf (615,0 Ko)

Denis


HI
I am working on a operating system Z/OS v2r2
Http server is installed and is correct on my lpar.

/etc/webap1/bin/apachectl -v

Server
version: IBM_HTTP_Server/9.0.0.0-PI54808 (Unix) Server
built: Jan 20 2016 17:19:40

Php is the tool of Rocket and is installed in :
/PRODUITS/ROCK/php
EUID=0
/PRODUITS/ROCK/php/
Type Filename
_,Dir
,.
_,Dir
,…
_,Dir ,bin
_,Syml ,CHANGES.ZOS
_,File ,fichier.php544.tar
_,Dir ,include
_,Dir ,lib
_,Dir ,man
_,File ,README
_,Syml ,README.ZOS
_,Dir ,share
_,Syml ,VERSION.ZOS

/PRODUITS/ROCK/php/bin/php -v
PHP 5.4.4 (cli) (built: Nov 21 2016 03:25:49)
Copyright © 1997-2012 The PHP Group
Zend Engine v2.4.0,
Copyright © 1998-2012 Zend Technologies

I made the export in the .profile of the user of the stc. (start server Apache)

export PATH=$PATH:/PRODUITS/ROCK/php/bin
export MANPATH=$MANPATH:/PRODUITS/ROCK/php/man/

When I want to see my page html, the command (php) are not interpreted.

Html page :

Standard HTML Page with PHP HelloWorld <?PHP print "Hello World"; print "
Generated with PHP"; ?>

Browser result :

Generated with PHP"; ?>.

I am looking for a installation guide and customization : Apache server z/OS and php ?
Can you help me ?
Best regards

Hi Patrik,

The following command must be working even without HTTP server, if you are using php-cgi interpreter in the command line:

/php/bin/php-cgi /etc/ihsapach/cgi-bin/php/myphp.php

The one of the reason of the error ‘No input file specified.’ - an incorrect path to the file.
And another probably reason - the incorrect permission on directory with executed file. Try to set the execute permission not only for files, but for directory with the files too.

Default directory for web files - /your/httpserver/htdocs.
If you are running php files by Apache from another directory, you may also specify an additional setting - change DocumentRoot directive in httpd.conf (as a path to the directory with *.php files), for example:

DocumentRoot “/etc/ihsapach/cgi-bin/php”

And then run the script by Apache:

http://141.171.36.169/phpinfo.php

Thanks,
Sergey