Source Code ✸ Downloads ✸ API Documentation ✸ Mailing Lists ✸ Bugs ✸ Developers
To compile PHP as a module for Naviserver, you need:
- installed Naviserver 4.99 or later - PHP 5.x or later - nsphp source code: https://bitbucket.org/naviserver/nsphp/
It has been tested with Drupal, RoundCube webmail, MailBee webmail, Mambo, Horder/IMP
$ cd nsphp $ wget http://www.php.net/distributions/php-5.1.4.tar.gz $ tar -xzf php-5.1.4.tar.gz $ mkdir php-5.1.4/sapi/naviserver $ cp nsphp.c config.m4 php.sym php-5.1.4/sapi/naviserver $ cd php-5.1.4 $ ./buildconf --force $ ./configure --with-naviserver <other options> $ make install $ cp libs/libphp5.so /usr/local/ns/bin
$ make build
and it will download and build libphp5.so and install it. By default it will install it into /usr/local/php and will copy libphp5.so into /usr/local/ns/bin
Then enable the PHP module:
ns_section "ns/server/${server}/modules" ns_param nsphp ${home}/bin/libphp5.so
Add a new section to pass options to PHP (required): The 'map' command will cause Naviserver to pass all requests to *.php to the PHP module (can be specified multiple times). Example:
ns_section "ns/server/${server}/module/nsphp" ns_param map *.php ns_param map *.php4
ns_php version Return PHP version ns_php eval string Evaluate PHP expression and return result ns_php evalfile filename Evaluate spacified PHP file ns_php call function Call PHP function and return result
ns_eval(Tcl_script); Evaluate Tcl code from PHP script and return result as string ns_log(severity,string); Put string in the server log, severity is one of 'Notice', 'Warning', 'Error', 'Debug', 'Fatal'
The Zend Optimizer is an application for increasing the performance of PHP scripts. It is also necessary if you want to run PHP scripts where the source is encoded with the Zend Guard software. Scripts encoded with the latest Zend Guard Software release 4 need the Zend Optimizer release 3.x. The installation of the Zend Optimizer adds some lines to your PHP.ini config file to tell PHP to load the required Optimizer binaries. Once loaded you are also able to run Zend Guard encoded scripts with Naviserver.