Open-source Languages & Tools for z/OS

 View Only
  • 1.  PHP Install and Integration to IBM_HTTP_Server/9.0.0.6

    Posted 11-04-2020 13:28
    Hi all,

    I've successfully installed PHP v5.4.4 into my OMVS environment and I've also successfully created an instance of IHS (IBM_HTTP_Server/9.0.0.6) in my z/OS 2.3 environment. I'm at a loss when it comes to integrating PHP into that HTTP server instance. I know there will need to be changes to my httpd.conf and that I'll have to create some sort of php.cgi file, but I cannot find any specifics when it comes to this. Does anyone have some basic PHP/IHS integration documentation which would at least get me to a point where a index.php page would successfully get parsed by the PHP engine?

    Thanks for any help or guidance,

    Andrew

    ------------------------------
    Andrew Arentsen
    Acuity Insurance
    ------------------------------


  • 2.  RE: PHP Install and Integration to IBM_HTTP_Server/9.0.0.6

    ROCKETEER
    Posted 11-05-2020 02:18
      |   view attached
    Hi Andrew Arentsen,
    As I remember IBM HTTP server instance is based on Apache, so httpd.conf should have the same sections.
    and index.php should be in the folder which is in the DocumentRoot section
    Found some of my old httpd.conf, attaching it, hope it'll help you.
    Btw we have php 7.0.5 available via miniconda.
    Thanks,
    Alex


    ------------------------------
    Alexander Klochkov
    Rocket Software
    ------------------------------

    Attachment(s)

    txt
    httpd.conf.example.txt   30 KB 1 version


  • 3.  RE: PHP Install and Integration to IBM_HTTP_Server/9.0.0.6

    Posted 11-05-2020 08:23
    Hi Alexander,

    I'm somewhat familiar with httpd.conf to know where the web documents go and how httpd.conf is used. This is where I'm confused. I found a thread that mentions a php.cgi file that should be created in my [IHS root]/cgi-bin. I believe this is because the IHS cannot run PHP in its address space and that PHP needs to be run as a CGI. This also makes sense because other documentation points at using the AddModule directive in httpd.conf to point at something like mod_php.so. I cannot find any *.so files included with Rocket's PHP port. Because we're not adding in modules to do PHP in Apache, PHP would be done via CGI.

    Your sample httpd.conf has these two entries:
    ScriptAlias /php/ "/u/user/miniconda/envs/php/"
    Action application/x-httpd-php "/php/bin/php-cgi"

    I'm not sure what these are pointing to. It looks like you've installed the PHP port in /u/user/miniconda/envs/php/. I'd expect that you have a /u/user/miniconda/envs/php/bin/php-cgi. I'm not sure where /php/bin/php-cgi is pointing to in your Action directive above.

    Is there any documentation or assistance that can be given to integrate with IHS? What would a php.cgi file contain in order to run PHP as a CGI? What particular entries need to be put into httpd.conf since it's not like a "normal" apache installation?

    If it helps, I've installed php to /spopt/rocket. 
    This means I have:
    /spopt/rocket/bin/php-cgi
    /spopt/rocket/lib/php.ini
    /spopt/rocket/lib/php/
    et cetra



    ------------------------------
    Andrew Arentsen
    Acuity Insurance
    ------------------------------



  • 4.  RE: PHP Install and Integration to IBM_HTTP_Server/9.0.0.6

    ROCKETEER
    Posted 11-05-2020 09:21
    Hi Andrew,

    here is what I have in /u/user/miniconda/envs/php:
    ls /u/user/.conda/envs/php
    bin conda-meta include lib php share
    ls /u/user/.conda/envs/php/bin
    php php-cgi php-config phpdbg phpize
    ...
    As for "Action application/x-httpd-php "/php/bin/php-cgi"":
    I don't remember how it's got there, I missed this section probably, but it was work ok with this setting as I remember.

    As for documentation, we don't have such manuals, maybe IBM has something for configuring IBM_HTTP_Server.

    Thanks,
    Alex



    ------------------------------
    Alexander Klochkov
    Rocket Software
    ------------------------------



  • 5.  RE: PHP Install and Integration to IBM_HTTP_Server/9.0.0.6

    ROCKETEER
    Posted 03-01-2021 12:21
    Edited by Vladimir Ein 03-01-2021 12:23
    For future reference, here's a short explanation of how those two lines in httpd.conf work.

    1. Action application/x-httpd-php "/php/bin/php-cgi"

    This tells Apache to process x-httpd-php MIME type with the CGI script "/php/bin/php-cgi". More details on this here:
    https://httpd.apache.org/docs/current/mod/mod_actions.html#action

    2. ScriptAlias /php/ "/u/user/miniconda/envs/php/"

    This maps the /php/ directory in URLs to the conda environment "/u/user/miniconda/envs/php/" in USS filesystem. More details here:
    https://httpd.apache.org/docs/current/mod/mod_alias.html#scriptalias

    In effect, .php files (mapped to application/x-httpd-php MIME type via AddType) are processed by the program /u/user/miniconda/envs/php/bin/php-cgi, which is a part of PHP distribution.


    I'm not sure if this is the best possible config - it might be better to map URLs directly to envs/php/bin subdirectory; I haven't tried this myself.

    --
    Vladimir





    ------------------------------
    Vladimir Ein
    Rocket Software
    ------------------------------