29
Novell www.novell.com novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE ®

Novell Developer Kit · Novell novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

n

NDK: PHP 5 for NetWare

Novell

m

ovdocx (EN

U) 01 February 2006

www . n o v e l l . c o

Developer Kit

J u n e 2 1 , 2 0 0 6

P H P 5 F O R N E T W A R E ®
Page 2: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

novdocx (EN

U) 01 February 2006

Legal Notices

Novell, Inc. makes no representations or warranties with respect to the contents or use of this documentation, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to revise this publication and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes.

Further, Novell, Inc. makes no representations or warranties with respect to any software, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to make changes to any and all parts of Novell software, at any time, without any obligation to notify any person or entity of such changes.

You may not use, export, or re-export this product in violation of any applicable laws or regulations including, without limitation, U.S. export regulations or the laws of the country in which you reside.

Copyright © 1993-2005 Novell, Inc. All rights reserved. No part of this publication may be reproduced, photocopied, stored on a retrieval system, or transmitted without the express written consent of the publisher.

Novell, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.novell.com/company/legal/patents/ and one or more additional patents or pending patent applications in the U.S. and in other countries.

Novell, Inc.404 Wyman Street, Suite 500Waltham, MA 02451U.S.A.www.novell.com

Online Documentation: To access the online documentation for this and other Novell developer products, and to get updates, see www.developer.novell.com/ndk. To access online documentation for Novell products, see www.novell.com/documentation.

Page 3: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

novdocx (EN

U) 01 February 2006

Novell Trademarks

For a list of Novell Trademarks, see Novell Trademark and Service Mark list (http://www.novell.com/company/legal/trademarks/tmlist.html)

Third-Party Materials

All third-party trademarks are the property of their respective owners.

Page 4: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

novdocx (EN

U) 01 February 2006

Page 5: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

Contents

novdocx (EN

U) 01 February 2006

Preface 7

1 Overview 91.1 Why is PHP Valuable to NetWare? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.2 What's New . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2 Getting Started 112.1 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2 Installing PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.3 Configuring PHP on NetWare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.3.1 Configuring PHP for Apache 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.3.2 Modifying Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.3.3 Restarting Apache 2.0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.4 Testing the Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.4.1 Executing the PHP Scripts from Command Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3 Functions and Extensions 153.1 Supported Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.2 Unsupported Functions in LDAP Extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.3 Unsupported Functions in Standard Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.4 Accessing LDAP Directories from PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3.4.1 Accessing LDAP over SSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.4.2 Changing eDirectory User Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.5 Accessing MultiByte String Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.6 Accessing MySQLi Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.7 Accessing MySQL from PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.8 Accessing OpenSSL Functions from PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.9 Accessing UCS from PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.10 Accessing XML Parser Scripts from PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4 NetWare Specific Notes 214.1 General Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2 INI Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.3 PHP Command Line Interface (CLI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.4 PHP-UCS Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5 Building PHP for NetWare 255.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.2 Steps to Build PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.3 Steps to Build PHP Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.4 NLM Location. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

5

Page 6: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

6 NDK: PHP 5

novdocx (EN

U) 01 February 2006

A PHP Links 27A.1 Web Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27A.2 Online Guides. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

B Revision History 29B.1 June 2006. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29B.2 October 2005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29B.3 March 2005. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

for NetWare

Page 7: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

novdocx (EN

U) 01 February 2006

Preface

This documentation describes the PHP programming language on NetWare. The guide is divided into the following sections:

• Chapter 1, “Overview,” on page 9• Chapter 2, “Getting Started,” on page 11• Chapter 3, “Functions and Extensions,” on page 15• Chapter 4, “NetWare Specific Notes,” on page 21• Chapter 5, “Building PHP for NetWare,” on page 25• Appendix A, “PHP Links,” on page 27

Documentation Conventions

In Novell documentation, a greater-than symbol (>) is used to separate actions within a step and items in a cross-reference path.

A trademark symbol (®, TM, etc.) denotes a Novell trademark. An asterisk (*) denotes a third-party trademark.

When a single pathname can be written with a backslash for some platforms or a forward slash for other platforms, the pathname is presented with a backslash. Users of platforms that require a forward slash, such as Linux or UNIX, should use forward slashes as required by your software.

User Comments

We want to hear your comments and suggestions about this manual and the other documentation included with this product. Please use the User Comment feature at the bottom of each page of the online documentation, or go to www.novell.com/documentation/feedback.html and enter your comments there.

7

Page 8: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

8 NDK: PHP 5

novdocx (EN

U) 01 February 2006

for NetWare

Page 9: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

1novdocx (E

NU

) 01 February 2006

1Overview

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. PHP-enabled web pages are treated just like regular HTML pages and you can create and edit them the same way you normally create regular HTML pages. Like any other CGI language, PHP can also be used to collect form data, create dynamic pages or send and receive cookie information. Its syntax draws upon C, Java, and Perl, and is easy to learn.

Though PHP supports a wide range of Web servers and databases, it is typically used with Apache Web Server and MySQL database. PHP can also be used for communicating with other services using protocols like HTTP, and FTP.

1.1 Why is PHP Valuable to NetWare?PHP is a scripting option for developers that provide a powerful web scripting language on the NetWare platform. With Apache Web Server and MySQL available on NetWare, the ideal combination which many Web developers seek, is now provided on NetWare. PHP provides the environment to run all kinds of applications.

1.2 What's New• PHP 5.0.5• MbString - A multibyte string extension with search and regular expression functionality• GD2 - a Graphical Extension

Overview 9

Page 10: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

10 NDK: PHP 5

novdocx (EN

U) 01 February 2006

for NetWare

Page 11: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

2novdocx (E

NU

) 01 February 2006

2Getting Started

This section describes the how to install, configure and test PHP on NetWare. These procedures only provide general guidelines. Most of the steps consist of suggested uses and are intended to be viewed as launching points rather than as solutions to your system needs.

2.1 System RequirementsNetWare 6.5 with SP3 or later, you can download this from the Novell Support site (http://support.novell.com/tools/csp)

or

Open Enterprise Server (OES)Apache Web server (version 2.0) for NetWare can be downloaded from the NDK site (http://developer.novell.com/ndk/apache.htm), if PHP is to be used with AMP (Apache, MySQL, PHP/Perl) combination.Latest UCS binaries, you can download this from the NDK site (http://developer.novell.com/ndk/ucs.htm)

2.2 Installing PHP To get the latest version, run the self extracting executable downloaded from the NDK site (http://developer.novell.com/ndk/php.htm).

or

Extract the .zip or tar.gz files on to NetWare SYS volume.

This will overwrite the default PHP installation on NetWare. While extracting the binaries, please make sure that the sys:/apache2/conf/mod_php.conf and sys:/php5/php.ini are backed up before performing any install related operations to prevent any custom changes from being overwritten during the installation process

NOTE: While upgrading from NW65 SP3 to later, sys:/php5/php.ini is backed up to sys:/php5/php.sp and sys:/apache2/conf/mod_php.conf to sys:/apache2/conf/mod_php.sp

2.3 Configuring PHP on NetWareTo configure PHP 5.0.5 on NetWare do the following steps. It is preconfigured on your system if you have selected AMP combination while installing NetWare.

2.3.1 Configuring PHP for Apache 2.0PHP works with the Apache Web Server using the mod_php5 apache module. The configuration for this interface is provided in the sys:\apache2\conf\mod_php.conf file.

To complete the configuration, add the following line in the sys:\apache2\conf\httpd.conf file.

Getting Started 11

Page 12: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

12 NDK: PHP 5

novdocx (EN

U) 01 February 2006

include sys:\apache2\conf\mod_php.conf

2.3.2 Modifying Directives The working of PHP is based on the various directives present in the sys:\php5\php.ini file.

The directives have been configured as recommended by the open source community, with the following deviations:

• Some applications might fail while accessing HTTP_*_VARS, where * refers to GET, POST, SERVER, COOKIE and SESSION. In this case, it is recommended to use Super Global Variables

If you want to avoid using super global variables, edit the .ini file as follows:

register_long_arrays = ON

Setting it to OFF will reduce the memory consumed.

• To enforce safe usage of PHP while executing programs or opening files the php.ini file has the following setting

safe_mode = ON

When safe_mode is set to ON, some of the applications might fail to work. To enable these applications, make changes accordingly.

• open_basedir = ".;sys:/tmp"

For more details on the various INI directives, refer to PHP Manual (http://in.php.net/manual/en/index.php)

IMPORTANT: All script related errors, warnings, and notices are now logged in sys:\php5\error.log instead of being displayed to the user. Modify error_reporting and log_errors in sys:\php5\php.ini if you want to change the setting.

2.3.3 Restarting Apache 2.0Execute the following command at server console to restart the Apache Web Server:

Legacy Usage Recommended Usage

$HTTP_GET_VARS[‘Query_String_Variable']

$_GET[‘Query_String_Variable']

$HTTP_POST_VARS[‘Query_String_Variable']

$_POST[‘Query_String_Variable']

$HTTP_SERVER_VARS[‘Query_String_Variable']

$_SERVER[‘Query_String_Variable']

$HTTP_COOKIE_VARS[‘Query_String_Variable']

$_COOKIE[‘Query_String_Variable']

$HTTP_SESSION_VARS[‘Query_String_Variable']

$_SESSION[‘Query_String_Variable']

for NetWare

Page 13: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

novdocx (EN

U) 01 February 2006

ap2webrs

2.4 Testing the InstallationAfter configuring PHP, test the installation through the following steps:

1 Write a info.php script and place it under sys:/apache2/htdocs folder

<?php

phpinfo();

?>

2 Access the script using your web browser. It will show the php installation details.

2.4.1 Executing the PHP Scripts from Command Line1 The CLI sample scripts are available in the sys:\php5\scripts folder.2 Execute the following command at the server console:php info.php

If the setup is correct, information about the PHP setup is displayed. Various configuration parameters, which can be modified in php.ini are also displayed.

By default, PHP tries to locate the script to be executed in sys:\php5\scripts or in any of the existing search paths. To execute scripts in other locations specify the full path of the file.

Getting Started 13

Page 14: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

14 NDK: PHP 5

novdocx (EN

U) 01 February 2006

for NetWare

Page 15: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

3novdocx (E

NU

) 01 February 2006

3Functions and Extensions

This section lists PHP functions and extensions applicable to the NetWare environment.

3.1 Supported Extensions

3.2 Unsupported Functions in LDAP Extension

3.3 Unsupported Functions in Standard Extension

For more information on the usage of various PHP functions, refer to PHP Documentation (http://www.php.net/docs.php)

Compiled-in Extensions

BCMath Arbitrary Precision Mathematics

Calendar FTP

PCRE Session handling Standard

Other Extensions

LDAP MySQL for 4.0 OpenSSL

UCS XML GD2

MbString MySQLi

ldap_set_rebind_proc ldap_8859_to_t61 ldap_sasl_bind

ldap_t61_to_8859

linkinfo money_format readlink

proc_nice symlink link

atanh asinh acosh

getrusage expm1 log1p

dns_get_mx dns_check_record checkdnsrr

crypt getmxrr dns_get_record

chown chgrp

Functions and Extensions 15

Page 16: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

16 NDK: PHP 5

novdocx (EN

U) 01 February 2006

3.4 Accessing LDAP Directories from PHPLDAP (Lightweight Directory Access Protocol) is used to access directory servers. Directory is a special kind of database that holds information in form of a tree structure. PHP for NetWare can access an LDAP directory through an LDAP extension.

The LDAP extension is enabled by default. If you want to disable this extension, comment the following entry in the sys:\php5\php.ini file.

extension=PHP_LDAP.NLM

3.4.1 Accessing LDAP over SSLTo establish an SSL based function with the server, use ldap_connect functions with hostname as ’ldaps://’. A value of 636 for the port also establishes an SSL connection.

LDAP extension on NetWare reads the server certificates from a specific directory and uses them for SSL communication. sys:/php5/cert directory is the default directory to store server certificates.

All certificates available in this directory, at the time of loading the extension, are considered for SSL operations. To use a different directory, modify the ldap.ssl_cert_dir directive under the LDAP section in the php.ini file.

Example :

ldap_connect with hostname as ldaps

<?php

// make sure you have the certificate for the host you are trying to connect // in your server

$ldaphost = "ldaps://ldap.example.com/";

// Connecting to LDAP

$ldapconn = ldap_connect($ldaphost)

or die("Could not connect to {$ldaphost}");

?>

Example:

ldap_connect with a value of 636 for port number argument

<?php

// make sure you have the certificate for the host you are trying to connect // in your server

$ldaphost = "ldap.example.com";

$port=636;

// Connecting to LDAP

for NetWare

Page 17: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

novdocx (EN

U) 01 February 2006

$ldapconn = ldap_connect($ldaphost, $port)

or die("Could not connect to {$ldaphost}");

?>

3.4.2 Changing eDirectory User PasswordA new function is available to change the password of an eDirectoryTM user.

bool ldap_change_password(resource link_identifier, string dn, string newpassword, [string oldpassword])

• link_identifier

Refers to the LDAP handle obtained from ldap_connect.• dn

Refers to the distinguished name of the object.• newpassword

The new password of the user.• oldpassword

Refers to the password which has to be changed. This parameter is optional if you have logged in as ADMIN user.

This function returns TRUE if the change was successful else a warning message is displayed.

IMPORTANT: This feature cannot be used to clear passwords and is specific to NetWare® eDirectoryTM.

Example:

$cr=ldap_change_password($ldapconn,"cn=MyName,o=MyOrg", "new_password", "old_password");

3.5 Accessing MultiByte String Extension1 Uncomment the following entry in sys:\php5\php.ini file.

extension=php_mbstring.nlm

2 Restart Apache2 Web Server using the following command at server console:ap2webdn

ap2webup

3.6 Accessing MySQLi Extension1 Download MySQL 4.1 for NetWare from the MySQL site (http://dev.mysql.com/downloads/

mysql)

Refer to accompanying documents for more details before carrying out the installation. 2 Install MySQL 4.1 for NetWare to sys:\mysql directory.

Functions and Extensions 17

Page 18: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

18 NDK: PHP 5

novdocx (EN

U) 01 February 2006

3 Copy the file sys:\mysql\bin\libmysql.nlm to sys:\system4 Unload any loaded instance of libmysql.nlm5 Uncomment the following entry in sys:\php5\php.iniextension=php_mysqli.nlm

6 Restart Apache2 Web Server using the following command at server console:ap2webdn

ap2webup

3.7 Accessing MySQL from PHPPHP for NetWare can access the MySQL database residing on the same NetWare server or on any other remote server through the MySQL extension.

This extension is enabled by default. To disable it, comment the following entry in the sys:\php5\php.ini file .

extension=PHPMYSQL.NLM

NOTE: :MySQL extension for MySQL 4.1 and above is available at the Forge site (http://forge.novell.com/modules/xfmod/project/?php). To enable this extension, follow the accompanying instructions.

3.8 Accessing OpenSSL Functions from PHPPHP for NetWare can use the functions of OpenSSL for generating and verifying the signatures and for sealing (encrypting) and opening (decrypting) data.

This extension is enabled by default. If the user wants to disable this extension comment the following entry in the sys:\php5\php.ini file.

extension=PHP_OSSL.NLM

3.9 Accessing UCS from PHPThis extension is enabled by default. If you want to disable this extension comment the following entry in the sys:\php5\php.ini file.

extension=PHP2UCS.NLM

Example:

To create a UCS object

$obj = new UCS("ucs_class_name")

If UCS_Class_Name has a "@" in it then the classname will be treated of type ucs2rmt. For other UCS class types UCS_Class_Name should be of the following type

prefix:classname.

The type of underlying UCS component is identified by the prefix.

for NetWare

Page 19: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

novdocx (EN

U) 01 February 2006

For more details about UCS refer to UCS document (http://developer.novell.com/ndk/ucs.htm)

3.10 Accessing XML Parser Scripts from PHP PHP for NetWare can create XML parsers and then define handlers for different XML events through the XML extension.

This extension is enabled by default. If the user wants to disable this extension comment the following entry in the sys:\php5\php.ini file.

extension=PHP_XML.NLM

Component type Example

UCX ucx:nwdir

JAVA java:java.util.Hashtable

Functions and Extensions 19

Page 20: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

20 NDK: PHP 5

novdocx (EN

U) 01 February 2006

for NetWare

Page 21: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

4novdocx (E

NU

) 01 February 2006

4NetWare Specific Notes

This section describes the various issues and changes that are specific to PHP for NetWare.

4.1 General NotesNote the points mentioned below while using the functions - popen(), system(), exec(), pass_thru() and proc_open():

• To load an NLMTM the full path of the file including the extension (.NLM) has to be provided. • Loading CLib based NLM will lead to an abend.• Console alias commands like modules cannot be passed to the above functions.• Unlike in Linux where popen allows only either read or write operation but not both on a child

process, NetWare allows both the operations, So it expects the user to explicitly read from the return value of popen.

• Interactive Mode enabled message will go to logger screen rather than to the PHP screen as the screen itself is created after parsing the command line arguments

• Some existing PHP 4.2.3 open source applications fail to work when migrated to PHP 5.0. For more information, see Migrating from PHP 4 to PHP5 (http://docs.php.net/en/migration5.html)

• Enabling PHP from the WebManager application by clicking Save > Apply might cause an abend. Restart might also result in an abend. To resolve this issue, click Save instead of Save > Apply and then stop and start the Apache server.

4.2 INI Entries• open_basedir:

This configuration directive limits the files that can be opened by a PHP script to the specified directory-tree, including the file itself. Multiple directories can be specified separated by semicolon (;).

This directive is a control at base level, irrespective of other file restriction directives. This directive works irrespective of whether the safe mode configuration directive is ON or OFF

Example:

open_basedir = ".;sys:/apache2/htdocs/phpscripts;sys:/php5"

Here "." always points to the directory where the script is located and not the current working directory as returned by the operating system at the time of file access.You can access only the following directories/files:

• directory where the script is loaded.• files in sysapache2/htdocs/phpscripts, and sysphp5 directories.

The restriction specified with open_basedir is a prefix and not a directory name.

This implies that ‘open_basedir = sys:/dir/incl’ permits access to ’sys:/dir/include’ and also to ’sys:/dir/incls’ directories, if they exist.

NetWare Specific Notes 21

Page 22: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

22 NDK: PHP 5

novdocx (EN

U) 01 February 2006

If access has to be restricted only to the specified directory, then end it with a slash as in the following example:

open_basedir = "sys:/dir/incl/"

• include_path:

This configuration directive specifies a list of directories for include(), require(), and fopen() functions, to locate files. Multiple directories can be separated by a semicolon (;).

Example:

include_path = ".;sys:/php5/includes"

• safe_mode:

This enables safety restrictions for a shared hosting environment where many web sites will be running as a single operating system user.

For NetWare, uid/gid values are not set and so safe_mode configuration directive is used for enabling safe_mode_exec_dir and safe_mode_include_dir directives.

• safe_mode_exec_dir:

This configuration directive restricts the execution of NLM's using system(), exec(), proc_open(), popen(), and pass_thru(), to only the specified directories. This is enabled only when the safe_mode configuration directive is set to ON.

Example:

safe_mode_exec_dir = "sys:/tmp"

This indicates that only those NLM's that are present in the "sys:/tmp" directory can be executed and all NLM's that are outside of this directory will not load through the above mentioned functions.

Only one directory can be specified into this configuration directive. If no entry is specified or if safe_mode is set to OFF, then PHP allows NLM's present in any directory on the system, to be loaded without any restriction.

• safe_mode_include_dir:

This configuration directive specifies a list of directories for which UID/GID checks are bypassed while including files from them or their subdirectories. Multiple directories can be separated by a semicolon (;).

Example:

safe_mode_include_dir = ".;sys:/php5/includes"

The restriction specified with safe_mode_include_dir is a prefix and not a directory name. This implies that "safe_mode_include_dir = sys:/dir/incl" permits access to "sys:/dir/include" and also to "sys:/dir/incls" directories, if they exist.

If access has to be restricted to only the specified directory, then end it with a slash as in the following example:

safe_mode_include_dir = "sys:/dir/incl/"

for NetWare

Page 23: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

novdocx (EN

U) 01 February 2006

4.3 PHP Command Line Interface (CLI) • Each CLI script execution starts in a new address space.• Each CLI script execution opens a new PHP Screen.• The open_basedir setting does not have a impact on CLI in NetWare.

Following NetWare specific INI directives are added in php.ini file.• autodestroy:

This option automatically closes the PHP screen after script execution.Example:php -d autodestroy=1 script_name

The execution of the above line will open a new PHP screen but will be automatically closed on completion of the script. The output of the script will not be directed to the NetWare Logger Screen.If this directive is not used, the output of the PHP script will be directed to the PHP screen.

• noscreen: This option inhibits the interaction of the script through standard input.Example:php -d noscreen=1 script_name

The execution of the above line will not open a new PHP screen. The output of the script will be directed to the NetWare logger screen.If this directive is not used the output of the PHP script will be directed to the PHP screen.

NOTE: If both the options are specified, noscreen will take a precedence.

• The output of php -h will be displayed on the the NetWare logger screen. • Error messages related to non-existence of the script will be directed to the NetWare logger

screen. •• Invoking Java classes using UCS from PHP CLI fails because JVM cannot be loaded in

protected address space.

4.4 PHP-UCS Extension• UCS constants is not available for usage.• UCX components which need to do realtime interrupts like COMPort will not work from the

CLI.

• UCS security control feature is modified using the sys:/system/nwsec.ini file. It can be turned ON or OFF by putting PHP=ON or PHP=OFF

The NWSEC.NLM component on NetWare forces the scripting languages to adhere to eDirectory rights. In PHP for NetWare, NWSec based security comes into picture only while accessing NetWare resources through PHP2UCS components.

This is not enabled for PHP functions like fopen(), fread(), for which open_basedir restriction will be in effect.

NetWare Specific Notes 23

Page 24: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

24 NDK: PHP 5

novdocx (EN

U) 01 February 2006

for NetWare

Page 25: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

5novdocx (E

NU

) 01 February 2006

5Building PHP for NetWare

This section describes the build procedure for PHP.

5.1 PrerequisitesCodewarrior compilerFlex and Bison toolsLibC header filesMPK toolsWinsock headersLDAP headers if LDAP extension has to be builtXML-EXPAT headers if XML extension has to be builtMySQL HeadersGeneric openssl sdk

5.2 Steps to Build PHPDownload and extract the PHP source for NetWare from the Novell Forge site (http://forge.novell.com/modules/xfmod/project/?php)

1 Change to the NetWare folder under the source directory.2 Edit the php-nw.bat and common.mif files to match your build environment.Run the php-nw

batch file.3 Set the build type as follows:

For release build execute the command: Setbuild r 2

For debug build execute the command: Setbuild d 2

4 For tsrm.lib execute the command: build tsrm [clean]

5 For zend.lib execute the command: build zend [clean]

6 For PHP5LIB.NLM execute the command: buildlib [clean]

NOTE: tsrm.lib and zend.lib are linked into PHP5LIB.NLM. So they need to be built first.

7 For MOD_PHP5.NLM execute the command: buildsapi apache2filter [clean]

8 For PHP.NLM execute the command:

Building PHP for NetWare 25

Page 26: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

26 NDK: PHP 5

novdocx (EN

U) 01 February 2006

buildsapi cli [clean]

5.3 Steps to Build PHP Extensions1 Keep the source files under ext\extension directory2 If it is a new extension, then create a makefile. Refer to the makefile in ldap extension directory

for details.3 buildext extension_directory [clean]

Example:Buildext ldap [clean]Buildext mysql [clean]

5.4 NLM Location1 PHP5LIB.NLM is created in the release or debug directory of the root of the project depending

on what has been built.2 PHP.NLM is created in sapi\cli\release or sapi\cli\debug directory depending on what has been

built.3 MOD_PHP5.NLM is created in sapi\apache2filter\release or sapi\apache2filter\debug directory

depending on what has been built.4 Extension NLMs are created in ext\extension directory\release or ext\extension

directory\debug directory.5 Move the above files to the locations mentioned below:

• PHP5LIB.NLM and PHP.NLM to sys:\php5 directory.• MOD_PHP5.NLM to sys:\apache2\modules directory.• Extension NLMs to sys:\php5\ext directory.

for NetWare

Page 27: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

Anovdocx (E

NU

) 01 February 2006

APHP Links

The popularity of PHP has given rise to an abundance of information about programming with PHP and using it with various products. Here are some links that you can use to know more about PHP.

A.1 Web PagesPHP home page (http://www.php.net)Zend site (http://www.zend.com)Pear site (http://pear.php.net)

A.2 Online GuidesPHP Manual (http://www.php.net/manual/en)PHP Security Guide (http://phpsec.org/projects/guide)

For latest PHP 5.0.5 Builds, refer Forge (http://forge.novell.com/modules/xfmod/project/?php)

PHP Links 27

Page 28: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

28 NDK: PHP 5

novdocx (EN

U) 01 February 2006

for NetWare

Page 29: Novell Developer Kit · Novell  novdocx (ENU) 01 February 2006 NDK: PHP 5 for NetWare Developer Kit June 21, 2006 PHP 5 FOR NETWARE®

Revision History

Bnovdocx (E

NU

) 01 February 2006

29

BRevision History

This section outlines all the changes that have been made to the PHP Admin Guide documentation (in reverse chronological order).

B.1 June 2006• Updated the Trademarks list to comply with revised Novell documentation standards

B.2 October 2005• Transitioned the exisitng document to new template• Changed date in front file to October 5, 2005• Modified Chapter 1, “Overview,” on page 9• Updated Section 2.4, “Testing the Installation,” on page 13• Added a note under Section 2.2, “Installing PHP,” on page 11• Added MySQLi , MbString and GD2 extension to Section 3.1, “Supported Extensions,” on

page 15• Added new NetWare specific issues to exising list under Chapter 4, “NetWare Specific Notes,”

on page 21• Modied the introduction to Appendix A, “PHP Links,” on page 27

B.3 March 2005• Added to NDK