PHP Configuration

Introduction

The PHP: Hypertext Preprocessor (PHP) can be used to create dynamic web pages using server-side scripting. PHP generally runs on a web server, taking PHP code as its input and creating Web pages as output. It can also be used for command-line scripting and client-side GUI applications. PHP can be deployed on most web servers and on almost every operating system and platform free of charge. In the details provided here, PHP has been deployed on an Apache web-server running on Linux. The PHP Group also provides the complete source code for users to build, customize and extend for their own use.

For a general definition see: http://en.wikipedia.org/wiki/PHP, but more comprehensive information is available from the offical site at http://www.php.net/.

MySQL was required in order to support the ZoneMinder application so that remote management and control of a suite of WebCams from the Linux server could be carried out. For details about the installation and configuration of ZoneMinder to use this, and other Webcams, see: ZoneMinder on the Linux Web-server.

The following guidance might be useful in helping to configure PHP on an Apache Web-server running on Linux.

My PHP Server Configuration

Essentially the default /etc/php.ini configuration file was retained as is.

The /etc/httpd/conf/httpd.conf configuration file was adjusted to ensure .php files were picked and used before .html files.

The /etc/httpd/conf.d/php.conf configuration file was adjusted to:

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php5_module modules/libphp5.so

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

Web pages

Web pages [filename].php are served up by the PHP processor in the web-server as HTML to the client browser. Many of the web-pages on this site are examples.

General Links

For general links to useful references when setting up PHP see: Apache resources on the Internet.

The following general links are useful references when setting up PHP:


URLSummary/Description
http://www.php.net/ Main PHP site
http://www.php.net/quickref.php PHP Quick Reference
http://uk3.php.net/features.commandline PHP: Using PHP from the command line (official reference)
http://uk.php.net/manual/en/index.php PHP Manual
http://www.4webhelp.net/ PHP coding, etc
http://hudzilla.org/phpwiki/index.php?title=Main_Page Practical PHP Programming
http://www.weberdev.com/ViewArticle/How-TO-Install-PHP%2C-Apache-and-MySQL-on-Linux-or-Unix How to Install PHP, Apache and MySQL on Linux or Unix
http://www.plus2net.com/php_tutorial/site_map.php PHP Tutorial
http://www.w3schools.com/php/default.asp PHP Tutorials
http://www.phpnoise.com/tutorials/ phpNoise - PHP Tutorials
http://www.php-mysql-tutorial.com/ PHP / MySQL tutorial
http://www.the-art-of-web.com/php/dirlist/1/ PHP: Directory Listing: Images
http://www.tizag.com/phpT/include.php The Include function
http://www.phpfreaks.com/phpref.php PHP Reference
http://www.digilife.be/quickreferences/quickrefs.htm Various quick references (such as PHP, MyQSQL, UNIX, etc)
http://www.freewebmasterhelp.com/tutorials/phpmysql/7 PHP/MySQL tutorial (complete 8 part process to set up a form accessing a MyQSL database)
http://www.free-php.net Free PHP scripts, resources and materials
http://www.wellho.net/solutions/php-using-frames-with-php.html Using PHP with frames
http://www.wellho.net/solutions/mysql-interfacing-applications-to-a-mysql-database-engine.html Interfacing to MySQL
http://www.webhostingtalk.com/showthread.php?t=402191: Specific forum thread
http://www.apache-php-mysql.com/ Apache PHP MySQL
http://www.php-cli.com/ PHP Command line Interface
http://php.resourceindex.com/ PHP resource Index
http://www.mysql-apache-php.com/ Quick Linux Server Installation