Installing APACHE, MYSQL & PHP

CS 2001 Internet Technologies

Part - B
Samantha Mathara Arachchi
E-mail:ssp@ucsc.cmb.ac.lk

1
SSP

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
2

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.
3

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.

4

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

6

Development process

7

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
8

9

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 - me@localhost.com) – Next

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

10

Installing PHP …
Installing & Configuring PHP Where can it be obtained http://www.php.net Read related docs http://www.php.net/manual/en/install.windows.ph p Download PHP http://www.php.net/downloads.php (From PHP site) php-4.3.6 (Local machine)
11

Installing PHP…

12

Installing PHP…

13

Installing PHP…

14

Installing PHP…

15

Installing PHP…
•To find php.ini configuration file

16

Installing PHP…
•Php.ini configuration file…

17

Configuration of Php.ini file

18

Installing PHP…
•To select htdocs folder..

19

Configuring httpd.conf

20

Where you can put your content…

21

Apache
The Apache is the most popular web server Reports from netcraft.com 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

22

Installing & configuring Apache
Where can it be obtained?
http://www.apache.org

Read related docs
http://httpd.apache.org/docs2.0/platform/windows.html

Download Apache
apache_2.0.49-win32-x86-no_ssl.msi (or latest version)

http://httpd.apache.org/download.cgi (From Apache site) Apache 2.0.49 (Local machine)
23

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

24

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
25

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

26

Configurations Apache-2
Post Configurations Apache-2 - Edit httpd.conf Section 2: 'Main' server configuration (Check this)
– ServerAdmin admin@admtc-int.lk – ServerName BR01.admtc-int.lk:80

27

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

28

START and STOP Apache2 …

29

START and STOP Apache2 …
Using normal Windows service management

30

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

31

Installing Database Server - MySQL
1. Download MySQL a. http://www.mysql.com/downloads/mysql-4.0.html 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

32

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. http://www.mysql.com/downloads/mysqlcc.html 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

33