C.1 General PHP 5 Configuration

 <  Day Day Up  >  

Since you're already using PHP, this section does not repeat the full set of PHP installation and configuration instructions. If you get stuck, information for many web servers and operating systems is available at http://www.php.net/install.

Instead of detailed instructions, this section provides a brief recap of the install process and a list of the new PHP 5 configuration options. In particular, there have been lots of changes in the MySQL extension and in all the XML extensions.

C.1.1 Basics

The latest version of PHP is always available from http://www.php.net/downloads.php. Unix installation basics are unchanged:

  1. $ gunzip php-5 . x . x .tar.gz

  2. $ tar xvf php-5 . x . x .tar

  3. $ cd php-5 . x . x

  4. $ ./configure

  5. $ make

  6. # make install

  7. # apachectl restart

The ./configure command will require additional parameters depending on your setup. These are discussed in more detail in the individual sections that follow.

You will probably need to run the make install and apachectl restart commands as the root user or superuser.

Windows users have two choices: they can use either the prebuilt binaries or the new Windows build system. If you don't want to customize PHP yourself, be sure to read the later Section C.3 for Windows-specific information.

People who are interested in building PHP on Windows should read the README.WIN32-BUILD-SYSTEM file in the top level of the PHP directory.

C.1.2 Configuration Options

PHP 5 has many new (or modified) extensions. In order to enable them properly, you must use some new configuration options. They break down into three main groups: XML, databases, and others.

C.1.2.1 XML

Since PHP 5 uses libxml2 , many of the PHP 4 configuration options have switched. Table C-1 lists the differences.

Table C-1. XML extension configuration options

Feature

PHP 4

PHP 5

libxml2

N/A

--disable-libxml--with-libxml-dir= DIR

DOM

--with-dom=[ DIR ]--with-dom-xslt=[ DIR ]--with-dom-exslt=[ DIR ]

--disable-dom

SimpleXML

N/A

--disable-simplexml

SOAP

N/A

--enable-soap

XSLT

--enable-xslt --with-xslt-sablot=< DIR >

--with-xsl=DIR

XML

--disable-xml --with- expat -dir=< DIR >

--disable-xml --with-libexpat-dir= DIR (deprecated)


The largest difference is that PHP 5 really wants you to have a copy of libxml2 on your system. If PHP cannot find it, specify its path using --with-libxml-dir= DIR .

Other XML extensions, including DOM and SimpleXML, are now enabled by default and will reuse the libxml2 path, so it only needs to be set once for the entire configuration process.

The SAX XML extension now also uses libxml2 , but you can use the old expat libraries if you insist. However, you must install them yourself: they are no longer bundled with PHP.

XSLT has switched from Sablotron to libxslt , so you may need to install libxslt to continue using XSLT.

C.1.2.2 Databases

The biggest disruption in PHP 5 is the unbundling of the MySQL client libraries. Therefore, you must download and install them yourself. Additionally, there's a new mysqli extension, which you should use for MySQL 4.1 and above.

A list of new database options appears in Table C-2.

Table C-2. Database extension configuration options

Feature

PHP 4

PHP 5

MySQL

--with-mysql[= DIR ]

--with-mysql= DIR

MySQLi

N/A

--with-mysqli= FILE

SQLite

N/A

--without-sqlite--enable-sqlite-utf8


Since the MySQL libraries aren't included with PHP, you must pass a path to --with-mysql to specify their location. For MySQLi, you now specify the location of the mysql_config file instead of the installation directory. MySQL extracts your setup information from this file.

Remember, MySQLi works only with MySQL 4.1.2 and above. If you're using both the mysql and mysqli extensions, configure them against the same version of MySQL to minimize problems.

SQLite is now bundled and is automatically enabled.

C.1.2.3 Other options

PHP 5 also bundles a few completely new extensions and removes some obsolete and experimental ones. Table C-3 contains a rundown of the major changes.

Table C-3. Other configuration options

Feature

PHP 4

PHP 5

Overload

--disable-overload

N/A

SPL

N/A

--disable-spl

Tidy

N/A

--with-tidy= DIR


Since overloading is now a built-in feature, there's no need to enable this as an extension. SPL is bundled and enabled by default. It requires no additional libraries. Tidy is bundled, but not enabled by default. You need to install Tidy to use the extension.

 <  Day Day Up  >  


Upgrading to PHP 5
Upgrading to PHP 5
ISBN: 0596006365
EAN: 2147483647
Year: 2004
Pages: 144

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net