Apache, PHP and MySQL Installations On Windows XP
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Apache, PHP and MySQL Installations On Windows XP

  • 22,442 views
Uploaded on

This tutorial will teach you to install Apache Web server, MySQL database and ...

This tutorial will teach you to install Apache Web server, MySQL database and
PHP. Apache is the famous web server nowadays. MySQL is the world's most popular open-sourced DBMS. PHP is the most popular scripting language on the web.
PHP is a server-side language that it runs in the server not in web browser. Like Apache and MySQL, PHP is a freely distributed software. It is an alternative to
other scripting language such as that of Sun’s JSP and Microsoft’s ASP framework. This tutorial
gives you a step by step guide on how you can install and configure PHP to work
together with the Apache HTTP Server and MySQL database on Windows XP.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
22,442
On Slideshare
22,419
From Embeds
23
Number of Embeds
4

Actions

Shares
Downloads
625
Comments
3
Likes
3

Embeds 23

http://www.rkchannel.com 20
http://facebook.slideshare.com 1
http://5549655990543663316_c00747e769a413911159297c5733559053c8e650.blogspot.com 1
http://www.slashdocs.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Apache, PHP and MySQL Installations On Windows XP By: Julian V. Jupiter June 09, 2009 1 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 2. Apache Installation 1. Double-click the installer. - apache_2.2.9-win32-x86-no_ssl-r2 2. Installer opens. Click Next. 3. Accept the terms in the license agreement 2 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 3. 4. Click Next. 5. Type in “localhost” for Network Domain and Server Name. Type in also the Administrator’s Email Address. If port 80 is not yet used, click Next. 6. Select Typical. Click Next. 3 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 4. 7. Click Next. 8. Wait while Apache is being installed. 9. Click Finish. 4 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 5. 10. Apache is now included to All Programs menu. 11. To test if Apache is installed properly, type in http://localhost to your web browser. Browser must open like the following: 5 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 6. 12. Instead of localhost or if localhost does not work, you can also use the default/local IP address of the computer, 127.0.0.1. 13. You can also use the name of your computer. My PC has its name “juju”. 6 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 7. To know your PC’s name open My Computer’s Properties and click Computer Name tab. 14. If you want a trick when opening your pages as if it is online, e.g. www.google.com, open “hosts” file with a text editor from C:WINDOWSsystem32driversetc. Change localhost with the desired name. I used www.juju.com. You can customize/edit the file index.html to desired page. 7 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 8. 15. Default web documents folder is C:Program FilesApache Software FoundationApache2.2htdocs. You will place all your documents here. 16. Configuration can be found at C:Program FilesApache Software FoundationApache2.2conf. You can easily open it from Apache folder in All Programs menu. This is needed to edit for loading PHP module or other modules. 8 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 9. 17. Starting, restarting and stopping the server when needed. 18. Other way to start, restart or stop the server is to click the Apache Service Monitor on Windows tray. Congratulations!!! 9 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 10. PHP Installation and Configuration for Apache 1. Extract the PHP zip and copy to C: directory. - php-5.2.6-Win32.zip 2. Rename the folder to php thus C:php. 3. C:php contains the following: - C:phpdev - C:phpext - C:phpextras - C:phpPEAR - C:phpphp.exe - C:phpphp-cgi.exe - C:phpphp-win.exe - C:php fdftk.dll - C:php gds32.dll - C:php php5apache2_2.dll - C:php php5ts.dll - …, etc. 4. Look for the file php.ini-recommended. Rename the file to php.ini. 10 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 11. 5. Open php.ini with your favorite text editor, e.g. Notepad. 6. Look for display_errors = Off on line 372. With this directive set to off, errors that occur during the execution of scripts will no longer be displayed as a part of the script output, and thus, will no longer be exposed to remote users. With some errors, the error message content may expose information about your script, web server, or database server that may be exploitable for hacking. Production sites should have this directive set to off. For development purposes, this directive should be set to On, thus make it display_errors = On. 11 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 12. 7. Open httpd.conf.txt on C:Program FilesApache Software FoundationApache2.2conf, or to easily open this file click Start>All Programs> Apache HTTP Server 2.2> Configure Apache Server and click Edit the Apache httpd.conf Configuration File. 8. Add PHP module to last line of list of modules on Apache configuration file. PHP module can be found on the top level of PHP directory. Since the Apache version is 2.2.x or 2.2.9, we used php5apache2_2.dll module. - Add LoadModule php5_module “C:/php/php5apache2_2.dll”. Take note: use “/” not “”. 9. Look for the line DirectoryIndex index.html which can be found on <IfModule dir_module> section. 12 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 13. Change it to DirectoryIndex index.php index.html. Apache will serve the file index.php (or the index.html if the former is not present) if a directory is requested. 10. Look for the following lines under <IfModule mime_module> section: - AddType application/x-compress .Z - AddType application/x-gzip .gz .tgz Add AddType application/x-httpd-php .php to the next line. 11. At the last line add PHPIniDir <php.ini directory> in order for the Apache to know the php.ini configuration. Save the file. 13 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 14. 12. Restart the Apache HTTP Server. Every time you make any changes to php.ini or httpd.conf you have to restart the server. Command-line prompts and fades away immediately if there is no mistake on configurations. It shows messages if there is any wrong in configuration. 13. To test if Apache and PHP work together, make a file with the following codes on your text editor and save with the desired name and with .php extension. In my case I use phpinfo.php. <?php phpinfo(); ?> Save this file to the top level of your document directory htdocs or you may create a folder to place it. Open your favorite web browser and open http://localhost/phpinfo.php. You can change localhost as discussed in Apache Installation. It should open the following: Congratulations!!! 14 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 15. MySQL Installation and Configuration for PHP 1. Double-click the installer. - mysql-essential-5.0.67-win32 2. Installer opens. Click Next. 3. Choose Setup Type. You can choose Typical for general use, Complete if all program featuresbe installed or Custom for advanced users. In my case I chose Complete. 15 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 16. 4. Click Install. 5. Wait while MySQL is being installed. 16 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 17. 6. Click Next. 7. Click Next. 17 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 18. 8. Leave Configure… remain check. Click Finish Note: If you uncheck Configure and want to open it later for instance configuration… go to Start>All programs>MySQL>MySQL Server 5.0> and click MySQL Server Instance Config Wizard. 18 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 19. 9. Instance configuration opens. Click Next. 10. Select Standard Configuration. Click Next. 19 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 20. 11. Check Install As Windows Service and choose Service Name. Check also Include Bin Directory… to open MySQL whatever directory your are in the Command Prompt. Click Next. 12. Enter password for the default user account, root. You can add more user accounts through this user account. Do not check Create An … Click Next. 20 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 21. 13. Click Execute. 14. Wait while processing configuration then click Finish. 21 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 22. 15. To start working with MySQL click MySQL Command Client. 16. The following opens: 22 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 23. Enter your password and press Enter: You may also open MySQL Command client by executing the command mysql –u <username> -h <host> -p on Command Prompt. 23 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 24. You can now execute SQL commands for creating databases, tables, etc. SQL commands are beyond the scope of this tutorial. To view databases, type in SHOW DATABASES (either case): To exit MySQL shell, simply type in exit: 24 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 25. 17. After MySQL has been installed, you need to configure PHP in order to have them connected. Take note that MySQL is not required for Apache to run PHP scripts unless you use MySQL databases in your scripts. - There are two ways in order to connect MySQL and PHP (I prefer to use second approach): 1. Copy mysql.dll and/or mysqli.dll from C:phpext to the top level of PHP installation, C:php. Open php.ini and look for php_mysql and php_mysqli under the list of extensions. Uncomment these lines: Save the file and restart the Apache server. 2. Open php.ini and look for extension_dir = “./”. Change this line to extension_dir = “<extension directory>” where extension directory is the directory for extensions to be loaded such as mysql.dll and/or mysqli.dll. The directory is C:phpext. 25 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 26. Look for php_mysql and php_mysqli under the list of extensions. Uncomment these lines: Save the file and restart the Apache server. 18. To know if PHP is now working with PHP, open again your file which contains the follwing code to your web browser. <?php phpinfo(); ?> Click refresh to your browser. Look for mysql and/or mysqli. If you see them then everything is fine. Take note: Mostly you have to restart your computer before you can see them on phpinfo() function. 26 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009
  • 27. Congatulations!!! Now that you have already installed PHP, you may now take the advantage of PHP programming. 27 Apache, PHP and MySQL Installations on Windows XP Created by: Julian V. Jupiter 6/13/2009