Installing APACHE, MYSQL & PHP

CS 2001 Internet Technologies

Part - B
Samantha Mathara Arachchi


Feature in PHP
PHP is mainly focused on server-side scripting There are three main fields where PHP scripts are used Server-side scripting Command line scripting. You can make a PHP script to run it without any server or browser Writing client-side GUI applications PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS

Feature in PHP …
with PHP, you have the freedom of choosing an operating system and a web server you are not limited to output HTML. PHP's abilities includes outputting images, PDF files and even Flash movies PHP is its support for a wide range of databases PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM Free / Open source Language syntax is similar to Perl, C, and JavaScript.

When will the script be executed?
The PHP script will be executed in Web server when the user requests the page.
– IMPORTANT: Nothing will happen if you view the page directly on local machine (by clicking with mouse)!

The PHP script will be executed sequentially from the top to the bottom.


Difference between JavaScript and PHP
JavaScript Category Where it is executed When it is executed Execution order Client-side scripting language Web browser When an event occurs (Eventdriven) Non-sequential (Event driven) Nothing happens if no events .html PHP Server-side scripting language Web server When user request the page from Web server Sequential (Top to bottom) Always executed .php

File extension If you open the page locally, (by mouse click) what will happen

Always executed just like the Nothing happens page from the Web (because (because Web browser it is client-side) cannot execute the script) You must upload to a PHP-enabled Web server in order to see the result 5

PHP verses other tools
Feature 1) Ownership 2) Language Independence 3) Database Connectivity 4) Session Handling 5) Dependence on other Environments PHP Open source Not Language Independent Easy Sessions Serverside, Independent of cookies ASP Proprietory Microsoft Language Independent Easy Sessions Dependent on cookies JSP Open source Not Language Independent Difficult - JDBC knowledge Sessions Depend on Servlets Dependent on Java Virtual Machine

Dependent on .Net Independent of or other Microsoft other Environments platform


Development process


Development process …
IMPORTANT: Development process of PHP is also different from JavaScript Edit PHP code with text editor or HTML editor (same as JavaScript) If your local PC is the Web server, copy php files into it If you’re using another Web server, upload the file (.php) to it with FTP client View the file with Web browser by entering URL of the file


Installing PHP
Click or double on click php-4.3.2-installer.exe Welcome – click License Agreement - I Agree Installation Type – Standard Choose Destination Location - choose current (C:\PHP ) Next Mail Configuration
– – Please enter the address of your SMTP server (If you have a Mail server then enter that name otherwise enter localhost ) Please enter the 'from' address for the mail function (If you have a real mail account for this enter that otherwise keep default - – Next

Server Type - Select the Apache – Next Start Installation -Next OK Run Apache Finish


Installing PHP …
Installing & Configuring PHP Where can it be obtained Read related docs p Download PHP (From PHP site) php-4.3.6 (Local machine)

Installing PHP…


Installing PHP…


Installing PHP…


Installing PHP…


Installing PHP…
•To find php.ini configuration file


Installing PHP…
•Php.ini configuration file…


Configuration of Php.ini file


Installing PHP…
•To select htdocs folder..


Configuring httpd.conf


Where you can put your content…


The Apache is the most popular web server Reports from indicate that Apache and its derivatives Apache does not run like a user application Instead it runs behind the scenes Providing services for other applications Apache is designed to work over a network Applications that talk to Apache can be on a different machine These applications are generally known as clients


Installing & configuring Apache
Where can it be obtained?

Read related docs

Download Apache
apache_2.0.49-win32-x86-no_ssl.msi (or latest version) (From Apache site) Apache 2.0.49 (Local machine)

Install Apache
1. Click on .msi file (apache_2.0.46-win32x86-no_src.msi) 2. Welcome page – click next 3. License Agreement – select Accept the terms in the license agreement 4. Read this – click next


Install Apache …
5.Server Information
– a. Network Domain. Enter the DNS domain in which your server is or will be registered in. – b. Server Name. Your server's full DNS name. – c. Administrator's Email Address – d. Enter the server administrator's or webmaster's email address here. This address will be displayed along with error messages to the client by default

Install Apache …
6. For whom to install - Apache Select for All Users, on Port 80 8. Setup Type - Select Typical 9. Destination folder – Keep Current path - click next 10. Install 11. Finish


Configurations Apache-2
Post Configurations Apache-2 - Edit httpd.conf Section 2: 'Main' server configuration (Check this)
– ServerAdmin – ServerName


START and STOP Apache2 …
Start & Stop Apache Normal starting, restarting and shutting down of an Apache service is usually done via the Apache Service Monitor command line can be used NET START Apache2 NET STOP Apache2


START and STOP Apache2 …


START and STOP Apache2 …
Using normal Windows service management


Test Apache
Apache will be listening on port 80 connect to the server and access launch a browser enter this URL http://localhost/ If nothing happens - look in the error.log file


Installing Database Server - MySQL
1. Download MySQL a. mysql-4.0.18 (Local machine) 2. Unzip the binary distribution 3. Click (or double click) on setup.exe 4. welcome page - click next 5. Information page - read carefully 6. choose destination location - keep current (c:\mysql) 7. click next 8. Finish


Installing Database Server – MySQL …
Configuring - MySQL Add this path to the mysql admin [WinMySQLAdmin] Server=C:/mysql/bin/mysqld-nt.exe Installing MySQL Control Center 1. Download MySQL Control Center a. mysqlcc-0.9.4 (Local machine) 2. Unzip the binary distribution 3. Click (or double click) on setup.exe 4. welcome page - click next 5. Accept the license agreement 6. Information page - read carefully 7. choose destination location - keep current 8. Select Features - Keep current 9. Install the package 10. Finish