1 of 23

Chapter 2: Apache, PHP and MySQL

  • Installation
  • Configuration
  • Files and directories

2 of 23

Apache Web Server

3 of 23

Apache web server

  • Apache web server was develop by the Apache Project Team, a collaborative software development effort aimed at creating a robust, full-feature and freely-available source code implementation of an HTTP (web) server.
  • Stable version: 2.x.x
  • Download Apache at http://httpd.apache.org/download.cgi
  • During installation, give unique port number to web server.
  • Do not activate 2 web server at the same time.
    • Only 1 web server running at one time.

4 of 23

Apache: Installation

  • Requirement
    • Windows NT, XP, 98
  • Installation wizard
    • Network Domain.
    • Server Name.
    • Administrator's Email Address.
    • For whom to install Apache
      • Select for All Users, on Port 80,
    • The installation type.
      • Select Typical
    • Where to install.
      • The default path is C:\Program Files\Apache Group under which a directory called Apache2 will be created by default.

5 of 23

Apache: Files and Directories

6 of 23

Apache: configuration

  • Startup file
    • Apache.exe
  • Configuration file
    • httpd.conf
      • Configuration file for alias hostname, port number, maximum file upload
  • Common path
    • Apache2/htdocs

7 of 23

Controlling startup and shutdown apache

8 of 23

Apache basic configuration

  • Server root setting

  • Document root setting

9 of 23

Apache basic configuration

  • Port setting to 80

  • Alias – used to point to the specific path in the local directory which is not set as the document root
  • In the following example explain when user call url http://localhost/icons/, it will point to the given path.

10 of 23

PHP Scripts & Parser

  • PHP: Hypertext Preprocessor
    • An HTML embedded scripting language
      • Designed to do something only after event occurs. e.g. when user submit forms
    • Use to develop dynamic web site
      • Better, faster and easier to learn
    • A server-side language, the code resides on a host computer that serves Web pages to the requesting visitors (client).

11 of 23

PHP Scripts & Parser

client

server

URL request

HTML

PHP

Script request

HTML

12 of 23

PHP files and directories

13 of 23

PHP: Configuration

  • Configuration file: php.ini – located in c:\windows
  • Installing as an Apache module
    • insert the two lines to Apache httpd.conf configuration file to set up the PHP module for Apache 2.0:

14 of 23

PHP: Configuration

  • Content of php.ini
    • max_execution_time
      • Controls how long PHP allows script to run
    • max_input_time
      • Controls the amount of time PHP allows scripts to parse all input data, including uploaded files
    • memory_limit (default 8MB)
      • Indicate how much memory a PHP script may consume
    • display_errors
      • Controls whether PHP displays errors on the screen
    • register_globals
      • Control whether to use older-style global variables for HTTP variables such as GET and POST data

15 of 23

16 of 23

17 of 23

MySQL server

  • A database being a collection of interrelated data, for text, numbers or binary files.
  • Open source database – http://www.mysql.com
  • Configuration file
    • my.ini
    • located in c:\WINDOWS\system32

18 of 23

MySQL: files and directories

19 of 23

Controlling startup and shutdown MySQL

20 of 23

phpMyAdmin : DBMS Manager

21 of 23

phpMyAdmin

  • phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the Web.
  • Functions
    • create and drop databases
    • create/drop/alter tables
    • delete/edit/add fields
    • execute any SQL statement
    • manage keys on fields,
    • manage privileges,
    • export data into various formats

22 of 23

Installation issues

  • Single installation
    • Separate installers
    • Need to do some configuration one each
  • Package installation
    • 3 in 1 package
    • Example: Appserv, VertrigoServ , WAMP

23 of 23

Chapter 2: Review

  • Apache as web server
  • PHP script need PHP parser to run
  • MySQL is a relational database management
  • PHPMyadmin as database manager