Parallels H-Sphere Documentation System Administrator Guide

 

Standalone PHP Installation

(H-Sphere 2.4.x; outdated since H-Sphere 2.5)
 
 

Related Docs:   H-Sphere PHP (HS 2.5+)

Last modified: 27 Dec 2007

 

WARNING: This documentation covers Parallels H-Sphere versions up to 3.1. For the latest up-to-date Parallels H-Sphere documentation, please proceed to the official Parallels site.

This step-by-step guide explains how to set up PHP in the standalone mode.

  1. Log into the target (e.g. web) server as root.
  2. Download PHP sources (any), extract the archive, and enter the directory.
  3. Compile and install standalone PHP:
    ./configure --prefix=/hsphere/shared/apache/php \
            --with-zlib-dir \
            --with-jpeg-dir \
            --with-png-dir \
            --with-gd \
            --with-mysql=/usr \
            --with-gettext \
            --disable-debug \
            --enable-versioning \
            --enable-sockets \
            --enable-track-vars \
            --with-pgsql=/usr \
            --enable-ftp \
            --localstatedir=/var/hsphere/php && make && make install
    

    You can add other options, too.

    Notes:

    • In versions before 4.3.0, php doesn't come with GD, and if you want to use your own GD library, specify the location:
      --with-gd=/hsphere/shared \
    • On FreeBSD systems, use the following paths for mysql and pgsql:
      with-mysql=/usr/local \
      with-pgsql=/usr/local \
  4. Create directory for PHP binary code and set the following ownership and permissions for it:
    mkdir /hsphere/local/bin
    chown -R root:root /hsphere/local/bin
    chmod -R 755 /hsphere/local/bin
  5. Copy PHP binary code into this directory:
    cp /hsphere/shared/apache/php/bin /hsphere/local/bin/php
  6. Add the following lines to /hsphere/local/config/httpd/httpd.conf :
              AddType application/x-httpd-php-external .php4 .phpext
              Action application/x-httpd-php-external "/hsphere/local/bin/php"
    
              #.php4, .phpext - extensions for scripts executed with external php as a user
    
              <Directory /hsphere/local/bin>
              Options +ExecCGI
              </Directory>
    
              ScriptAlias /php/bin/ /hsphere/local/bin/
    
  7. Create directory cgi-php inside domain's home directory for php scripts to work through CGI and set the following ownership and permissions for it:
    mkdir cgi-php
    chown user:user cgi-php
    chmod 755 cgi-php
    * Make sure all php scripts in this directory have permissions 755 and domain owner's ownership.

  8. Include new CGI directory into domain's VirtualHost config:
    ScriptAlias /cgi-php "/hsphere/local/home/user/domain/cgi-php"
    where <user> and <domain> are the user's and name and domain's home directory.
    * Note, that when an end user clicks the Apply changes link on the Web Options page, php scipts will stop working through CGI for their account.

  9. All php scripts in this directory must call binary php. For example:
    #!/hsphere/local/bin/php
    <?php
    echo ("Test string");
    ?>
  10. Set the following permissions for /hsphere/local/var/httpd/logs/suexec_log:
    chmod 666 /hsphere/local/var/httpd/logs/suexec_log

    * This is quite insecure. We are in process of solution to it.
  11. Execute apache config test and ensure there are no errors in the config file:
    /hsphere/shared/apache/bin/apachectl configtest
  12. Restart apache:
    /hsphere/shared/apache/bin/apachectl stop
    /hsphere/shared/apache/bin/apachectl start

Related Docs:   H-Sphere PHP (HS 2.5+)



© Copyright 2017. Parallels Holdings. All rights reserved.