Post on 08-Aug-2015
transcript
Herat University
Faculty of Computer Science
Manually Installing Apache Server
Php,Mysql & PhpMyAdmin on Windows
Prepared by: Khosrow Kian & Zalmai Arman
Requirements Latest Version:
Ms Visual C++ 2010 SP1 Redistributable Package (x86) - Windows 32bit
Ms Visual C++ 2010 SP1 Redistributable Package (x64) - Windows 64bit
Or
Ms Visual C++ 2012 x86, x64 Redistributable Package Windows 32bit and 64bit.
Apache Server 2.4 win64
Apache Server 2.4 win32
php-5.5.16-Win32-VC11-x64
php-5.5.16-Win32-VC11-x64
Requirements Latest Version:
Apache Server 2.4 win64
Apache Server 2.4 win32
php-5.5.16-Win32-VC11-x64
php-5.5.16-Win32-VC11-x64
phpMyAdmin-4.2.7.1-all-languages mysql-5.6.20-win32_2
mysql-5.6.20-winx64
Manually Installing Apache Server on Windows
To be able to run Apache 2.2 and 2.4 VC10, Visual Studio C++ 2010 SP1 must be
installed on our system.
Create a new folder in C Drive name it "Apache" extract the httpd zip file to anywhere
on your computer and then copy all files and folders over into "C:\Apache" - Navigate to "C:\Apache\conf" folder, double click "httpd.conf" to open it.
Find the Server Root: on line 37
ServerRoot "c:/Apache24” change it to ServerRoot "c:/Apache”
Find the Server Admin: on line 209
ServerAdmin admin@example.com change it to localhost
Manually Installing Apache Server on Windows
Find the Server Name: on line 218
www.example.com:80 change it to localhost:80
Find the DocumentRoot and Directory : on line 242 & 243
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
change it to
DocumentRoot "c:/Apache/htdocs"
<Directory "c:/Apache/htdocs">
Find the cgi-bin Directory: on line: 375 - <Directory "c:/Apache24/cgi-bin"> change it
to <Directory "c:/Apache/cgi-bin">
Save the configuration file.
Manually Installing Apache Server on Windows
Installing
Now, go to the Start Menu > All Programs > Accessories, right-click "Command
Prompt" and then click "Run as Administrator"
Navigate to the Apache's bin folder by typing "cd \apache\bin" in the Command shell
and then press Enter, type in "httpd -k install" to install the Apache service and then
press Enter. If you got any error displayed here, you should fix them first before you
try to start the Apache Server. To start the Apache Server simply type in "httpd -k
start" and then press Enter.
Open your browser and navigate to "http://localhost"
Manually Installing Apache Server on Windows
Uninstall Apache
Open Command Prompt with administrator right (Start Menu > All Programs >
Accessories, right-click "Command Prompt" and then click "Run as Administrator")
type in "cd \apache\bin" and press Enter, first we will stop the Apache server, type in
"httpd -k stop" and then press Enter. Next type in "httpd -k uninstall" to uninstall the
Apache Service.
How to install PHP on Windows
Before installing PHP you need to install Apache Server first and make sure that it's
running properly.
Once you've php zip file, unzip it to wherever you want.
Create a new folder in "C:\Apache" name it "php" so the path to the folder is
"C:\Apache\php"
Copy all files and folders you've unzipped over to "C:\Apache\php".
In the folder "C:\Apache\php" find and rename "php.ini-production" to "php.ini"
Double click the php.ini to open it and find the following line:
Find the doc_root: on line 710
Add path to the Document Root, you can find it in your Apache configuration file:
doc_root = change it to doc_root="c:/Apache/htdocs"
How to install PHP on Windows
Find the Server Root: on line 37
ServerRoot "c:/Apache24” change it to ServerRoot "c:/Apache”
Find the extension_dir: on line 721
;extension_dir = “ext” change it to extension_dir=“c:\apache\php\ext”
Create a new folder in "C:\Apache" name it "temp" inside the "temp" folder create 2
folders name them "upload" and "session" Now we got 2 new folders, they are
"C:\Apache\temp\upload" and "C:\Apache\temp\session“
Find the upload_tmp_dir: on line 791
;upload_tmp_dir = change it to upload_tmp_dir = "C:\Apache\temp\upload"
How to install PHP on Windows
Find the session.save_path : on line 1390
;session.save_path = “/tmp” change it to session.save_path = "C:\Apache\temp\session"
Adding PHP to the System Path.
Open up System Properties, to open it right click
My Computer and then click Properties, in the
Control Panel Home menu click Advanced System
Settings.
In the Advanced tab click on Environment Variables.
How to install PHP on Windows
Adding PHP to the System Path.
In the "System Variable" double click "Path“
variable to edit it, add path "C:\Apache\php“
into the Variable value, click OK to save the
configuration.
%SystemRoot%\system32;%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%
\System32\WindowsPowerShell\
v1.0\C:\Apache\php
The Computer must be restarted to take effect.
Connecting the Apache Server with PHP.
To connect the Apache Server with PHP we need to edit the Apache Configuration
file located at C:\Apache\conf\httpd.conf
Add index.php to the line on line 276
Connecting the Apache Server with PHP.
Add the following lines between <IfModule mime_module> and </ IfModule>
after line 404
ScriptAlias /php/ "C:/Apache/php/"
AddType application/x-httpd-php .php .php5
Action application/x-httpd-php "/php/php-cgi.exe"
SetEnv PHPRC "C:/Apache/php"
Connecting the Apache Server with PHP.
Add the following lines to the end of the httpd.conf
PHPIniDir "C:/Apache/php/“
LoadModule php5_module "C:/Apache/php/php5apache2_4.dll“
Restart Apache Server.
4
Connecting the Apache Server with PHP.
Test PHP
Open up Notepad, copy and paste the code below:
<?php
phpinfo();
?>
Save the file into Apache document root "c:/Apache/htdocs" as "phpinfo.php“
Open up browser, in the address bar type in "http://localhost/phpinfo.php" and then
press Enter.
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows
How to install MySQL on Windows Test MySQL from the Command prompt
Open up Command prompt by clicking Start menu, in the search box type in "cmd"
and then press "Enter" In the command shell type in:
Type in "\q" to quit MySQL and then
"exit" to exit the Command prompt.
Connecting PHP with MySQL Open up PHP Configuration file located at "C:\Apache\php\php.ini" under the
Dynamic Extensions find the extensions below:
Uncomment the extensions by removing the semicolon ";" in front of them: on line 875 & 876
Save the file and restart Apache Server.
Testing MySQL Open up Notepad, copy and paste the following codes, Enter your MySQL password and save
the file into the Apache Document Root "c:/Apache/htdocs" as “info.php"
<?php
$dbServer='localhost';
$dbUser='root';
$dbPass=''; // our password was null.
$dbName='test';
$link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect to
MySQL");
print "<h1>Connected to MySQL successfully</h1>";
mysql_select_db("$dbName") or die("Could not Select Database");
print "<h2>Database selected successfully</h2>";
mysql_close($link);
?>
Testing MySQL
Open up browser, in the address bar type in "http://localhost/info.php" and then hit Enter.
How to install phpMyAdmin on Windows
Extract the zip file to the Apache Document Root (c:/Apache/htdocs). Rename the folder to
"PhpMyAdmin" so the path to the folder is “c:/Apache/htdocs\PhpMyAdmin"
In the PhpMyAdmin folder find and rename "config.sample.inc.php“ to "config.inc.php"
Open config.inc.php with Text editor (Notepad).
Find the line below: on line 29
$cfg['Servers'][$i]['auth_type'] = 'cookie';
And replace these lines:
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = „ ';
$cfg['Servers'][$i]['auth_type'] = 'config';
And line 38 must be true: $cfg['Servers'][$i]['AllowNoPassword'] = true;
Save the file.
Open up PHP configuration file located at "C:\Apache\php\php.ini" find the extension below: on line
873
;extension=php_mbstring.dll change it to extension=php_mbstring.dll
How to install phpMyAdmin on Windows Open browser, in the address bar type in "http://localhost/phpmyadmin/"
How to install phpMyAdmin on Windows At the bottom of the page you might see a warning message about
phpMyAdmin configuration storage.
The phpMyAdmin needs a database to store data and information. The database can be
imported from the phpMyAdmin installation folder using phpMyAdmin we've just installed.
At the top of the phpMyAdmin window click "Import"
How to install phpMyAdmin on Windows In the "File to Import" browse to " c:/Apache/htdocs\PhpMyAdmin
\examples\create_tables.sql" and then click "GO" to start importing the
database.