installing apache and php

16
INSTALLING APACHE AND PHP MANUAL INSTALLATION By: Abdullah Khokhar

Upload: software-engineering

Post on 07-Aug-2015

64 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Installing apache and php

INSTALLING APACHE AND PHP

MANUAL INSTALLATION

By: Abdullah Khokhar

Page 2: Installing apache and php

APACHE INSTALLATION

Page 3: Installing apache and php

APACHE DOWNLOAD

You can download latest version of apache from

http://www.apachelounge.com/download/

Select VC11 from left menu. Then you have to install visual c++ distribution and apache win32 or win64 depending on version of your operating system as shown in picture in next slide.

Page 4: Installing apache and php

APACHE DOWNLOAD

OR

Visual C++ Distribution

Apache 64-Bit

Apache 32-Bit

Page 5: Installing apache and php

APACHE INSTALLATION

Extract your apache and copy folder named Apache24 or similar named. And paste it in “c:\” C Drive. Now rename Apache directory to “apache” without quotations.

Path to apache directory now, should look like “c:\apache” without quotations.

Now go to c:\apache\conf and open httpd.conf Find “c:/Apache24” without quotations and replace all of them with “c:/apache” without quotations.

Now Find “ServerName” without quotations in httpd.conf and remove # before it and replace

ServerName www.example.com:80 With ServerName localhost:80

Page 6: Installing apache and php

APACHE INSTALLATION

Go to Start menu and run cmd (command prompt) as an administrator

Run following commands in cmd:

cd/

cd apache/bin

Now you will have c:\apache\bin in your cmd

Run “httpd.exe” without quotations in cmd and apache will run as an application but we need to run it as a service. So press “ctrl c” from your keyboard to stop apache.

Page 7: Installing apache and php

APACHE INSTALLATION

Go to control panel and search services or find “view local services” in control panel and find the apache service from the list. It should not be installed at the moment.

Now,

Right click on my computer and select properties, go to “Advanced System Settings” menu, a window will appear then. Below in the window you will find “Environmental Variables” click that.

And follow the steps shown in figure on next slide

Page 8: Installing apache and php

2

1

3

Page 9: Installing apache and php

5

4

6Add below in textfield:;c:\apache\bin

Page 10: Installing apache and php

APACHE INSTALLATION

Close cmd and open again as administrator. Now you can access “httpd.exe” any location you are. No need to go to “c:\apache\bin”.

Run below command in cmd

httpd –k install

This will install apache as a service in windows services, to uninstall it you have command

httpd –k uninstall

Your apache server is installed now, it can be used as a service. To turn it on or off, go to “c:\apache\bin” directory and run Apache monitor or open windows services as explained in previous slides and run apache from there.

Page 11: Installing apache and php

PHP DOWNLOAD

You can download latest version of php from

http://windows.php.net/download

Go below and you will find achieve.

Select VC11 PHP package of PHP win32 or win64 depending on version of your operating system as shown in picture in next slide.

Page 12: Installing apache and php

1

Page 13: Installing apache and php

2OR

Page 14: Installing apache and php

PHP INSTALLATION

Extract your php and copy folder to “c:/” C Drive. Now rename PHP directory to “php” without quotations.

Path to php directory now, should look like “c:/php” without quotations.

Now go to c:\php and rename the file “php.ini-recommended” to “php.ini” without quotations

Now edit php.ini and find “doc_root” without quotations and replace with

doc_root = “c:/apache/htdocs”

Page 15: Installing apache and php

PHP INSTALLATION

Now find extension_dir = “ext”, remove “;” before it and replace it with extension_dir = “c:/php/ext”

Go to c:\apache\conf directory now and open “httpd.conf” file. Paste below content at the very end of the httpd.conf file

LoadModule php5_module “c:/php/php5apache2_4.dll"

AddType application/x-httpd-php .php

PHPIniDir “c:/php"

Page 16: Installing apache and php

FINISHING INSTALLATION

If you want to test that your configuration is correct. Go to cmd and type a command

httpd –t

This will show you “Syntax ok” without quotations if your configuration is correct. Otherwise errors will be shown in cmd.

Now restart apache server and run a php script.