Appendix A. PHP Installation


PHP installation is really an easier process than many people make it out to be. The key to a proper PHP installation is simply to follow the instructions, step-by-step. However, sometimes there are problems that are not covered in the bundled documentation or the online documentation, and that is what this appendix is for. This appendix is not a substitute for the online documentation, but rather a supplement to it.

This appendix addresses some common problems and questions that I've noticed users of PHP from the php-install@lists.php.net mailing list are having.

PHP always displays header information saying that my Web site uses PHP. How do I change that?

You can stop that header information from being displayed by setting the expose_php php.ini entry to "Off" .

I run PHP for my shell scripts. How do I get PHP to stop printing the content-type header every time my script executes?

Comment out the default_mimetype and default_charset php.ini entries, and you shouldn't see any unnecessary headers being printed. Alternatively, run PHP with --q (quiet) option.

Where can I get the latest PHP distribution?

You can get the latest PHP distribution from http://www.php.net/; look under the Downloads section.

How do I install PHP with Zeus Web server?

You have two options: You can install PHP in CGI mode and then use it with Zeus as you would do with Perl or any other language, or you can install PHP as an ISAPI module. You should read the README.Zeus file in the top-level directory of the PHP 4 distribution.

Why can't I work with BCMath as I can with PHP 3?

PHP can no longer be bundled with the BCMath library because of licensing issues. Therefore, you must download the BCMath package separately and then configure PHP with --enable-bcmath . An example of this is given in the next section.

How do I install PHP 4 with Apache/MySQL/GD/BCMath and SSL support?

Although configure processes might vary, here is a sample configure I use and that should work pretty well for you:

 #Grab the sources from the following URLs OpenSSL: ftp://ftp.openssl.org/source/openssl-0.9.5.tar.gz ModSSL: ftp://ftp.modssl.org/source/mod_ssl-2.6.4-1.3.12.tar.gz Apache: http://www.apache.org/dist/apache_1.3.12.tar.gz MySQL: http://www.mysql.org/Downloads/MySQL-3.22/mysql-3.22.32.tar.gz PHP4:  http://www.php.net/do_download.php?download_file= php-4.0.0.tar.gz&source_site=www.php.net GD 1.8.2: ftp://ftp.boutell.com/pub/boutell/gd/gd-1.8.2.tar.gz BCMath: http://www.php.net/extra/number4.tar.gz # Decompress the sources: % tar xvzf openssl-0.9.5.tar.gz % tar xvzf mod_ssl-2.6.2-1.3.12.tar.gz % tar xvzf apache_1.3.12.tar.gz % tar xvzf php-4.0.0 % tar xvzf mysql-3.22.32.tar.gz % tar xvzf gd1.8.2.tar.gz # Compile the sources: # GD support % cd gd1.8.2 % make #MySQL Support % cd ../mysql-3.22.32 % ./configure % make % make install % scripts/mysql_install_db % safe_mysqld & % mysqladmin -u root password 'yourpasswordhere' #OpenSSL Support % cd ../openssl-0.9.5 % sh config \ >    -fPIC % make #ModSSL Support % cd ../mod_ssl-2.6.2-1.3.12 % ./configure \ >     --with-apache=../apache_1.3.12 #Initial Apache Build % cd ../apache_1.3.12 % SSL_BASE=../openssl-0.9.5 \ % ./configure \ >        --prefix=/usr/local/apache \ >        --enable-module=most \ >        --enable-shared=max \ >        --enable-module=ssl \ >        --enable-shared=ssl % make % make certificate 

At this point, if you don't already have a file called /usr/local/apache/conf/httpd.conf, you should do the following:

 % mv conf/httpd.conf /usr/local/apache/conf/httpd.conf 

That way you'll have a fresh httpd.conf file with all the Apache modules listed and loadable. Otherwise, you will need to merge your existing custom httpd.conf information into the new one.

 % make install # Ahhh, at last the PHP4 installation % cd ../php-4.0.0 % mv /usr/local/number4.tar.gz . % tar xvzf number4.tar.gz % ./configure \ >      --with-apxs=/usr/local/apache/bin/apxs \ >      --with-config-file-path=/usr/local/apache/conf \ >      --enable-versioning \ >      --with-mysql \ >      --with-ftp \ >      --with-gd=/usr/local/gd1.3 \ >      --enable-bcmath=yes \ >      --disable-debug \ >      --enable-memory-limit=yes \ >      --enable-track-vars % make % make install 

How do I send the PHP build script to different nonstandard directories to look for specific libraries and header files?

Just specify the path after the --with- argument. So if you wanted the configure script to look in /root/dist/ for the header files to the swf module, you could do the following:

 ./configure --with-swf=/root/dist/ 

How do I build shared PHP extensions?

Almost every PHP extension can be built as a shared library. To do so, specify shared after the --with- or --enable- argument and before any optional library paths. Some examples are

 ./configure --with-mysql=shared --with-swf=shared,/root/dist 

How do I make PHP look in a nonstandard directory for header files and libraries?

You can achieve this by setting the CFLAGS and LDFLAGS environment variables before installing PHP:

 CFLAGS=-I/path/to/include LDFLAGS=-L/path/to/library 

Then all you have to do is configure!

Where can I find the libraries I need for building different PHP options?

Here's a list of links to the Web sites with the different options:

LDAP (UNIX): ftp://ftp.openldap.org/pub/openldap/openldap-stable.tgz

LDAP (UNIX/Windows): Netscape Directory (LDAP) SDK 1.1--there is also a free LDAP server at ftp://ftp.critical-angle.com/pub/cai/slapd/

Berkeley DB2 (UNIX/Windows): http://www. sleepycat .com/

SNMP (UNIX): http://www.ece.ucdavis.edu/ucd-snmp/ (Note: PHP uses the native SNMP interface in Windows)

GD (UNIX/Windows): http://www.boutell.com/gd/#buildgd

mSQL (UNIX): http://www.hughes.com.au/

MySQL (UNIX): http://www.mysql.com/

InterBase: http://www.interbase.com/

Hyperwave: http://www.hyperwave.com/

filePro: http://www.fileproplus.com/

FTP: Nothing required

EXIF: Nothing required

WDDX: Nothing required

IMAP (Windows/UNIX): ftp://ftp.cac.washington.edu/imap/old/imap-4.5.tar.Z

FreeType (libttf): http://www.freetype.org/

ZLib (UNIX/Win32): http://www. cdrom .com/pub/infozip/zlib/

expat XML parser (UNIX/Win32): http://www.jclark.com/xml/ expat .html

PDFlib: http://www. pdflib .com

ClibPDF: http://www.fastio.com

DOM XML: ftp://ftp.gnome.org/pub/GNOME/stable/sources/libxml/

mcrypt: ftp://argeas.cs-net.gr/pub/unix/ mcrypt /

mhash: http://sasweb.de/mhash/

t1lib: http://www.neuroinformatik.ruhr-uni-bochum.de/ini/PEOPLE/rmz/t1lib/t1lib.html

dmalloc: http://www. dmalloc .com/

aspell: http://download. sourceforge .net/aspell/aspell-.29.1.tar.gz

Readline: ftp://prep.ai.mit.edu/pub/gnu/readline/

SWF (*nix systems only): http://reality.sgi.com/graphica/flash

GNU gettext: ftp://ftp.gnu.org/gnu/gettext/

Recode: ftp://ftp.gnu.org/gnu/recode/

MCAL: http://mcal.chek.com/

FDF: http:// partners .adobe.com/asn/developer/acrosdk/forms.html

Informix: http://www.informix.com/

Oracle: http://www.oracle.com/

CyberCash: http://www. cybercash .com/

I compiled PHP and MySQL with mod_perl and now I'm getting an error. What happened ?

Most likely, you compiled PHP with the bundled MySQL sources. If you do that, everything will blow up in your face. Instead, install PHP with your own MySQL libraries, so the following configure line:

 ./configure --with-mysql --with-apxs 

becomes

 ./configure --with-mysql=/usr/local/mysql --with-apxs 

when mod_perl is installed.

Why aren't my old DLLs and DSOs working with PHP 4?

When you use PHP 4, you have to use PHP 4 DLLs, not PHP 3 DLLs. The same thing applies for the DSOs. If you're on a Windows system and you need the functionality from one of PHP's DLLs, check out http://download.swwwing.com/.

It's not my fault, it's PHP's fault. Where do I report this?

Make sure that it's really PHP's fault. Bogus bug reports waste the time of the people who develop PHP. First, report your problem to php-install@lists.php.net and if no one helps you and it seems like a bug, go to the Bugs database at

http://bugs.php.net/

How do I install PHP on a Windows system?

php.net does have some nice installation links, such as one to a PHP Installer, which is a friendly interface to install PHP on Windows systems. Should you need more resources than php.net provides, try php4win.de which offers a comprehensive set of information for installing PHP on Windows systems.

This appendix hasn't answered my question. I'll never get PHP installed, right?

Wrong. If you need more help installing PHP on your system, you can post your question to the PHP mailing list and usually get a response back within an hour or two. For help with PHP installation, send your questions to php-install@lists.php.net.



PHP Developer's Cookbook
PHP Developers Cookbook (2nd Edition)
ISBN: 0672323257
EAN: 2147483647
Year: 2000
Pages: 351

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