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)
- MySQL (required)
- ldap (optional - for authentication)
- imap (optional - for authentication)
- GD (optional - for image resizing)
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
- Install Microsft IIS
- Download PHP5 installer for windows.
Download PHP5 ZIP package (contains libraries) for windows.
- Run PHP5 installer. By default this will install to C:\php
- Copy the ext folder from the PHP5 zip package to C:\php so you end up with
C:\php\ext
- Copy files libmysql.dll, libeay32.dll, ssleay32.dll from the PHP5 zip package
to C:\php.
- 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
- 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!
- Download and install Apache 2.2
- Download php5 (zip file not installer)
- Unzip php5 contents to c:\php5
-
Add c:\php5 to windows path
- Go to Control Panel and open the System icon (Start -> Settings -> Control Panel -> System, or just Start -> Control Panel -> System for Windows XP/2003)
- Go to the Advanced tab
- Click on the 'Environment Variables' button
- Look into the 'System Variables' pane
- Find the Path entry (you may need to scroll to find it)
- Double click on the Path entry
- Enter your PHP directory at the end, including ';' before (e.g. ;C:\php5)
- Press OK and restart your computer
-
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>
-
Edit httpd.conf and add this line (includes previously created file):
Include conf/extra/httpd-php.conf
-
Rename C:\php5\php.ini.recommended to C:\php5\php.ini
- Edit php.ini and uncomment the following lines
extension=php_mysql.dll
extension=php_ldap.dll
extension=php_imap.dll
- 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