Download - Installing apache and php
INSTALLING APACHE AND PHP
MANUAL INSTALLATION
By: Abdullah Khokhar
APACHE INSTALLATION
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.
APACHE DOWNLOAD
OR
Visual C++ Distribution
Apache 64-Bit
Apache 32-Bit
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
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.
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
2
1
3
5
4
6Add below in textfield:;c:\apache\bin
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.
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.
1
2OR
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”
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"
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.