Table of contents

Brushtail Administrator's Guide

PHP

Introduction


PHP5
This is the current version of PHP.

PHP Extensions

The following PHP extensions need to be enabled (windows) or compiled (linux)

Windows
edit php.ini and uncomment the following lines
extension=php_gd2.dll
extension=php_imap.dll
extension=php_ldap.dll
extension=php_mysql.dll
extension=php_sockets.dll

If using sqlite database you will need the following
extension=php_pdo.dll
extension=php_pdo_sqlite.dll
extension=php_sqlite.dll

Linux
The configure command could look something like this
./configure --with-apxs2=/var/www/bin/apxs --with-mysql --with-ldap --with-gd --with-jpeg-dir=/usr/lib

Below are some (very brief) instructions for installing PHP on windows

PHP5 and Microsft IIS webserver on Windows

  1. Install Microsft IIS
  2. Download PHP5 installer for windows.
    Download PHP5 ZIP package (contains libraries) for windows.
  3. Run PHP5 installer. By default this will install to C:\php
  4. Copy the ext folder from the PHP5 zip package to C:\php so you end up with C:\php\ext
  5. Copy files libmysql.dll, libeay32.dll, ssleay32.dll from the PHP5 zip package to C:\php.
  6. Edit C:\windows \php.ini

    set parameter

    extension_dir = "C:\php\ext"

    uncomment the lines

    extension=php_mysql.dll
    extension=php_ldap.dll
    extension=php_imap.dll
  7. Under Control Panels > Administrative Tools > Services > World Wide publishing
    restart the web server.

PHP5 and Apache2.2 web server on Windows

A very rough guide!

  1. Download and install Apache 2.2
  2. Download php5 (zip file not installer)
  3. Unzip php5 contents to c:\php5
  4. Add c:\php5 to windows path
  5. Create a new file in your Apache installation in /conf/extra/ called "httpd-php.conf" containing following lines

    LoadModule php5_module "C:/php5/php5apache2_2.dll"

    <IfModule php5_module>
    AddType application/x-httpd-php .php .php3 .php5
    AddType application/x-httpd-php-source .phps
    PHPIniDir "C:/php5"
    </IfModule>

  6. Edit httpd.conf and add this line (includes previously created file):
    Include conf/extra/httpd-php.conf
  7. Rename C:\php5\php.ini.recommended to C:\php5\php.ini
  8. Edit php.ini and uncomment the following lines

    extension=php_mysql.dll
    extension=php_ldap.dll
    extension=php_imap.dll
  9. Under Control Panels > Administrative Tools > Services >
    Restart apache service

Testing PHP



The default document directory with Apache2 is C:\Program Files\Apache Group\Apache2\htdocs.

The default document directory with Microsoft IISis C:\Inetpub\wwwroot.

To test your PHP installation create a test file in the default document directory called test.php. In this file have the following code.

<?

phpinfo();

?>

Viewed through a web browser, http://localhost/test.php, you should see a page like this that lists the parameters of the PHP installation.




php.ini



To change PHP parameters you need to edit the php.ini file and restart the web server. Relevant parameters include.

Security
register_globals = Off



File uploads

memory_limit = 10M
post_max_size = 8 M
upload_max_filesize = 8M
file_uploads = On


(duration of sessions in seconds)
session.gc_maxlifetime = 28800

; For Win32 only.
sendmail_from = root@blah.org

PHP4

PHP4 is no longer under development. Please use PHP5. The following is included for reference purposes.

As of MySQL version 4.1, MySQL changed the way it stored passwords so PHP4 will not connect to a default installation.


You will need to create a MySQL user account and store the password in the old format.


mysql> SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

See the MySQL website for more details. http://dev.mysql.com/doc/mysql/en/Old_client.html





Table of contents