Download - Installing APACHE, MYSQL & PHP
-
8/13/2019 Installing APACHE, MYSQL & PHP
1/33
11
Installing APACHE, MYSQLInstalling APACHE, MYSQL
&&PHPPHP
SamanthaSamantha MatharaMathara ArachchiArachchi
EE--mail:[email protected]:[email protected]
SSP
CS 2001 Internet TechnologiesCS 2001 Internet Technologies
Part - B
-
8/13/2019 Installing APACHE, MYSQL & PHP
2/33
22
Feature in PHPFeature in PHPPHP is mainly focused on serverPHP is mainly focused on server--side scriptingside scripting
There are three main fields where PHP scriptsThere are three main fields where PHP scripts
are usedare used
ServerServer--side scriptingside scripting
Command line scripting. You can make aCommand line scripting. You can make a
PHP script to run it without any server orPHP script to run it without any server orbrowserbrowser
Writing clientWriting client--side GUI applicationsside GUI applications
PHP can be used on all major operatingPHP can be used on all major operatingsystems, including Linux, many Unix variantssystems, including Linux, many Unix variants
(including HP(including HP--UX, Solaris andUX, Solaris and OpenBSDOpenBSD),),
Microsoft Windows, Mac OS X, RISC OSMicrosoft Windows, Mac OS X, RISC OS
-
8/13/2019 Installing APACHE, MYSQL & PHP
3/33
33
Feature in PHPFeature in PHP with PHP, you have the freedom of choosing anwith PHP, you have the freedom of choosing an
operating system and a web serveroperating system and a web server
you are not limited to output HTML.you are not limited to output HTML. PHP'sPHP's
abilities includes outputting images, PDF filesabilities includes outputting images, PDF files
and even Flash moviesand even Flash movies
PHP is its support for a wide range of databasesPHP is its support for a wide range of databases
PHP also has support for talking to otherPHP also has support for talking to other
services using protocols such as LDAP, IMAP,services using protocols such as LDAP, IMAP,
SNMP, NNTP, POP3, HTTP, COMSNMP, NNTP, POP3, HTTP, COM
Free / Open sourceFree / Open source
Language syntax is similar toLanguage syntax is similar to PerlPerl, C, and, C, and
JavaScript.JavaScript.
-
8/13/2019 Installing APACHE, MYSQL & PHP
4/33
44
When will the script beWhen will the script be
executed?executed?
The PHP script will beThe PHP script will be executed in Webexecuted in Webserverserver when the user requests the page.when the user requests the page.
IMPORTANTIMPORTANT: Nothing will happen if you view: Nothing will happen if you view
the page directly on local machine (by clickingthe page directly on local machine (by clickingwith mouse)!with mouse)!
The PHP script will be executedThe PHP script will be executed
sequentially from the top to the bottom.sequentially from the top to the bottom.
-
8/13/2019 Installing APACHE, MYSQL & PHP
5/33
55
Nothing happens
(because Web browsercannot execute thescript)
You must upload to aPHP-enabled Web
server in order to seethe result
Always executedjust like the
page from the Web (becauseit is client-side)
If you open the page
locally,
(by mouse click)what will happen
.php.htmlFile extension
Sequential (Top to bottom)
Always executed
Non-sequential (Event driven)
Nothing happensif noevents
Execution order
When user request thepage from Web server
When an event occurs (Event-driven)
When it is executed
Web serverWeb browserWhere it is executed
Server-side scripting
language
Client-side scripting languageCategory
PHPJavaScript
Difference between JavaScript and PHPDifference between JavaScript and PHP
-
8/13/2019 Installing APACHE, MYSQL & PHP
6/33
66
PHP verses other toolsPHP verses other tools
Dependent on JavaVirtual Machine
Dependent on .Netor other Microsoft
platform
Independent ofother Environments
5) Dependenceon other
Environments
Sessions Depend
on Servlets
Sessions Dependent
on cookies
SessionsServerside,Independent of
cookies
4) SessionHandling
Difficult - JDBCknowledge
EasyEasy3) DatabaseConnectivity
Not Language
Independent
Language
Independent
Not Language
Independent
2) Language
Independence
Open sourceProprietory -Microsoft
Open source1) Ownership
JSPASPPHPFeature
-
8/13/2019 Installing APACHE, MYSQL & PHP
7/33
77
Development processDevelopment process
-
8/13/2019 Installing APACHE, MYSQL & PHP
8/33
88
IMPORTANTIMPORTANT: Development process of PHP is: Development process of PHP is
also different from JavaScriptalso different from JavaScriptEdit PHP code with text editor or HTML editorEdit PHP code with text editor or HTML editor(same as JavaScript)(same as JavaScript)
If your local PC is the Web server, copyIf your local PC is the Web server, copy phpphp filesfilesinto itinto it
If youre using another Web server, upload theIf youre using another Web server, upload thefile (.file (.phpphp) to it with FTP client) to it with FTP client
View the file with Web browser by entering URLView the file with Web browser by entering URLof the fileof the file
Development processDevelopment process
-
8/13/2019 Installing APACHE, MYSQL & PHP
9/33
99
-
8/13/2019 Installing APACHE, MYSQL & PHP
10/33
1010
Click or double on click phpClick or double on click php--4.3.24.3.2--installer.exeinstaller.exeWelcomeWelcomeclickclick
License AgreementLicense Agreement -- I AgreeI Agree
Installation TypeInstallation TypeStandardStandard
Choose Destination LocationChoose Destination Location -- choose current (C:choose current (C:\\PHP ) NextPHP ) NextMail ConfigurationMail Configuration
Please enter the address of your SMTP server (If you have a MailPlease enter the address of your SMTP server (If you have a Mail server thenserver thenenter that name otherwise enterenter that name otherwise enter localhostlocalhost ))
Please enter the 'from' address for the mail function (If you haPlease enter the 'from' address for the mail function (If you have a real mailve a real mailaccount for this enter that otherwise keep defaultaccount for this enter that otherwise keep default -- [email protected]@localhost.com))NextNext
Server TypeServer Type -- Select the ApacheSelect the ApacheNextNext
Start InstallationStart Installation --NextNext
OKOK
Run ApacheRun Apache
FinishFinish
Installing PHPInstalling PHP
-
8/13/2019 Installing APACHE, MYSQL & PHP
11/33
1111
Installing & Configuring PHPInstalling & Configuring PHP
Where can it be obtainedWhere can it be obtainedhttp://http://www.php.netwww.php.net
Read related docsRead related docs
http://http://www.php.net/manual/en/install.windows.phwww.php.net/manual/en/install.windows.phpp
Download PHPDownload PHP
http://http://www.php.net/downloads.phpwww.php.net/downloads.php (From PHP(From PHP
site)site)phpphp--4.3.64.3.6 (Local machine)(Local machine)
Installing PHP Installing PHP
-
8/13/2019 Installing APACHE, MYSQL & PHP
12/33
1212
Installing PHPInstalling PHP
-
8/13/2019 Installing APACHE, MYSQL & PHP
13/33
1313
Installing PHPInstalling PHP
-
8/13/2019 Installing APACHE, MYSQL & PHP
14/33
1414
Installing PHPInstalling PHP
-
8/13/2019 Installing APACHE, MYSQL & PHP
15/33
1515
Installing PHPInstalling PHP
-
8/13/2019 Installing APACHE, MYSQL & PHP
16/33
1616
Installing PHPInstalling PHPTo find php.ini configuration file
-
8/13/2019 Installing APACHE, MYSQL & PHP
17/33
1717
Installing PHPInstalling PHPPhp.ini configuration file
-
8/13/2019 Installing APACHE, MYSQL & PHP
18/33
1818
Configuration ofConfiguration of Php.iniPhp.ini filefile
-
8/13/2019 Installing APACHE, MYSQL & PHP
19/33
1919
Installing PHPInstalling PHP
To select htdocs folder..
-
8/13/2019 Installing APACHE, MYSQL & PHP
20/33
2020
ConfiguringConfiguring httpd.confhttpd.conf
-
8/13/2019 Installing APACHE, MYSQL & PHP
21/33
2121
Where you can put your contentWhere you can put your content
-
8/13/2019 Installing APACHE, MYSQL & PHP
22/33
2222
ApacheApache
The Apache is the most popular web serverThe Apache is the most popular web server
Reports fromReports from netcraft.comnetcraft.com indicate thatindicate thatApache and its derivativesApache and its derivatives
Apache does not run like a user applicationApache does not run like a user applicationInstead it runs behind the scenesInstead it runs behind the scenes
Providing services for other applicationsProviding services for other applications
Apache is designed to work over a networkApache is designed to work over a networkApplications that talk to Apache can be on aApplications that talk to Apache can be on adifferent machinedifferent machine
These applications are generally known asThese applications are generally known asclientsclients
-
8/13/2019 Installing APACHE, MYSQL & PHP
23/33
2323
Installing & configuring ApacheInstalling & configuring Apache
Where can it be obtained?Where can it be obtained?
http://http://www.apache.orgwww.apache.org
Read related docsRead related docshttp://httpd.apache.org/docs2.0/platform/windows.htmlhttp://httpd.apache.org/docs2.0/platform/windows.html
Download ApacheDownload Apacheapache_2.0.49apache_2.0.49--win32win32--x86x86--no_ssl.msi (or latest version)no_ssl.msi (or latest version)
http://http://httpd.apache.org/download.cgihttpd.apache.org/download.cgi (From(From
Apache site)Apache site)Apache 2.0.49Apache 2.0.49 (Local machine)(Local machine)
-
8/13/2019 Installing APACHE, MYSQL & PHP
24/33
2424
Install ApacheInstall Apache
1. Click on .1. Click on .msimsi file (apache_2.0.46file (apache_2.0.46--win32win32--
x86x86--no_src.msi)no_src.msi)2. Welcome page2. Welcome pageclick nextclick next
3. License Agreement3. License Agreementselect Accept theselect Accept theterms in the license agreementterms in the license agreement
4. Read this4. Read thisclick nextclick next
-
8/13/2019 Installing APACHE, MYSQL & PHP
25/33
2525
5.Server Information5.Server Information
a. Network Domain. Enter the DNS domain ina. Network Domain. Enter the DNS domain inwhich your server is or will be registered in.which your server is or will be registered in.
b. Server Name. Your server's full DNS name.b. Server Name. Your server's full DNS name.
c. Administrator's Email Addressc. Administrator's Email Address
d. Enter the server administrator's ord. Enter the server administrator's or
webmaster's email address here. Thiswebmaster's email address here. This
address will be displayed along with erroraddress will be displayed along with error
messages to the client by defaultmessages to the client by default
Install Apache Install Apache
-
8/13/2019 Installing APACHE, MYSQL & PHP
26/33
2626
6. For whom to install6. For whom to install -- Apache SelectApache Select forfor
All Users, on Port 80All Users, on Port 808. Setup Type8. Setup Type -- Select TypicalSelect Typical
9. Destination folder9. Destination folderKeep Current pathKeep Current path-- click nextclick next
10. Install10. Install
11. Finish11. Finish
Install Apache Install Apache
-
8/13/2019 Installing APACHE, MYSQL & PHP
27/33
2727
Configurations ApacheConfigurations Apache--22
Post Configurations ApachePost Configurations Apache--22 -- EditEdit
httpd.confhttpd.confSection 2: 'Main' server configurationSection 2: 'Main' server configuration
(Check this)(Check this)
ServerAdminServerAdmin admin@[email protected]
ServerNameServerName BR01.admtcBR01.admtc--int.lk:80int.lk:80
-
8/13/2019 Installing APACHE, MYSQL & PHP
28/33
2828
Start & Stop ApacheStart & Stop Apache
Normal starting, restarting and shuttingNormal starting, restarting and shuttingdown of an Apache service is usually donedown of an Apache service is usually done
via the Apache Service Monitorvia the Apache Service Monitor
command line can be usedcommand line can be used
NET START Apache2NET START Apache2
NET STOP Apache2NET STOP Apache2
START and STOP Apache2 START and STOP Apache2
-
8/13/2019 Installing APACHE, MYSQL & PHP
29/33
2929
START and STOP Apache2 START and STOP Apache2
-
8/13/2019 Installing APACHE, MYSQL & PHP
30/33
3030
Using normal Windows service managementUsing normal Windows service management
START and STOP Apache2 START and STOP Apache2
-
8/13/2019 Installing APACHE, MYSQL & PHP
31/33
3131
Test ApacheTest Apache
Apache will be listening on port 80Apache will be listening on port 80
connect to the server and accessconnect to the server and access
launch a browserlaunch a browser
enter this URL http://enter this URL http://localhostlocalhost//If nothing happensIf nothing happens -- look in thelook in the error.logerror.log filefile
-
8/13/2019 Installing APACHE, MYSQL & PHP
32/33
3232
Installing Database ServerInstalling Database Server -- MySQLMySQL
1. Download1. Download MySQLMySQL
a. http://www.mysql.com/downloads/mysqla. http://www.mysql.com/downloads/mysql--4.0.html4.0.html
mysqlmysql--4.0.184.0.18 (Local machine)(Local machine)2. Unzip the binary distribution2. Unzip the binary distribution
3. Click (or double click) on3. Click (or double click) on setup.exesetup.exe
4. welcome page4. welcome page -- click nextclick next5. Information page5. Information page -- read carefullyread carefully
6. choose destination location6. choose destination location -- keep current (keep current (c:c:\\mysqlmysql))
7. click next7. click next8. Finish8. Finish
-
8/13/2019 Installing APACHE, MYSQL & PHP
33/33
3333
ConfiguringConfiguring -- MySQLMySQL
Add this path to theAdd this path to the mysqlmysql adminadmin
[[WinMySQLAdminWinMySQLAdmin]]
Server=Server=C:/mysql/bin/mysqldC:/mysql/bin/mysqld--nt.exent.exe
InstallingInstalling MySQLMySQL Control CenterControl Center
1. Download1. Download MySQLMySQL Control CenterControl Center
a. http://a. http://www.mysql.com/downloads/mysqlcc.htmlwww.mysql.com/downloads/mysqlcc.html
mysqlccmysqlcc--0.9.40.9.4 (Local machine)(Local machine)2. Unzip the binary distribution2. Unzip the binary distribution3. Click (or double click) on3. Click (or double click) on setup.exesetup.exe4. welcome page4. welcome page -- click nextclick next5. Accept the license agreement5. Accept the license agreement6. Information page6. Information page -- read carefullyread carefully7. choose destination location7. choose destination location -- keep currentkeep current8. Select Features8. Select Features -- Keep currentKeep current9. Install the package9. Install the package10. Finish10. Finish
Installing Database ServerInstalling Database Server MySQLMySQL