Apache server + PHP + MySql

Source: Internet
Author: User

Recently, I decided to install a working Apache 2.4/PHP 5.4 and MySQL 5.5 running locally on my Windows 7 laptop for web design.

InstallingAmp(Apache, MySQL and PHP) has become quite easier with single wizard based installations available as a packet these days. Like using XAMPP, Wamp you can just install them and use. But with these
Setups, you will have (or will not have) less knowledge about processing ing them each in your own way because they will present some user interface where you can directly do locations by one click. you will not know what exactly required for changing something
In Apache, PHP or MySQL. So to have knowledge on deployments on them according to your requirement, You have to install each application individually.

The installation and deployments of PHP, Apache and MySQL in Windows has also become quite easier these days because they provide some default deployments. as PHP, after its latest releases I. e.5.4, does not provide
Downloads of vc6 version (the PHP compiled with Visual C ++ 2005 compiler ), because it is believed that the performance of the PHP compiled with vc9 (Compiled with Visual C ++ 2008 or later) has improved quite a lot than the compiled with vc6. so to work
The latest vc9 version of PHP, you must have installed PHP with vc9 compiled Apache as well or you use IIS as Web server. vc9 compiled Apache is provided
Apache Lounge (apachelounge.com)Not the original Apache (apache.org). Since I haven'tworked yet with IIS and always work with Apache in anyway, I don't have knowledge about
The IIS & PHP. Here I am going to explain few steps on how to install PHP 5.4 and Apache 2.4 in Windows

Where to install?

Since I have not used any installers for both PHP and Apache, I will be downloading the pre compiled zipped packages and install them in my
D Drive. The folder structure will look like below:

  • D:/etc/Apache-Apache installation
  • D:/etc/PHP-PHP installation
  • D:/etc/MySQL-mysql Installation
  • D:/etc/MySQL/databases-MySQL DATA folder
  • D:/etc/www-document root folder

Note:You can change the drive and path for the installations in your own way.

Download
  1. DownloadThe latestApache 2.4.3 (As of writing this) from
    Http://www.apachelounge.com/download/ (direct link for the current)
    Version-http://www.apachelounge.com/download/win32/binaries/httpd-2.4.3-win32.zip)
    And unzip it in D:/etc/Apache. I do not use the OpenSSL one here.
  2. Download the archive version 5.4.9 from
    Http://windows.php.net/download (http://windows.php.net/downloads/releases/archives/php-5.4.9-Win32-VC9-x86.zip)
    And unzip it in D:/etc/PHP. while downloading PHP, choose the thread safe version for Windows. I do not use the latest version 5.4.10, because that I cannot get the corresponding PHP and Apache Connector DLL file from the location in step 3.
  3. Download php5apache2_4.dll-php-5.4-win32.zip
    For the PHP and Apache Connector DLL file
    Http://www.apachelounge.com/download/win32/modules-2.4/php5apache2_4.dll-php-5.4-win32.zip)
    And extract the file php5apache2_4.dll and copy it to D:/etc/PHP.
Deployments

Though the deployments may vary from individual's requirement but here I will be discussing for some basic deployments in PHP and Apache.

 

Apache
  1. Open the file D:/etc/Apache/CONF/Httpd. confIn any text editor (I use my lovely notepad ++) then find and make the following changes/deployments
    Per your installation path.
  2. Set the server root
ServerRoot "D:/etc/apache"
  1. Enable required Apache modules. I just uncomment one more
    Mod_rewriteModule.
  2. Add the following lines somewhere (I did just below the module enabling)
LoadModule php5_module "d:/etc/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "d:/etc/php"
  1. Change Server Admin email address
ServerAdmin info@yoursite.com
  1. Change the document root:
DocumentRoot "d:/etc/www"
<Directory "d:/etc/www">
  1. If you want to allow. htaccess ("distributed configuration file") to be used under document root do the following under <directory "D:/etc/www">
AllowOverride All
  1. Find the follwoing and replace the path:
ScriptAlias /cgi-bin/ "d:/etc/apache/cgi-bin/"
<Directory "d:/etc/apache/cgi-bin">
  1. Add index. php In Directory Index

Directoryindex index.htmlIndex. php

 

PHP
  1. Rename PHP. ini-development to PhP. ini
  2. Find extension directory setting and set the path as per your installation.
extension_dir = "d:\etc\php\ext"
  1. Uncomment (remove the simicolon
    ;From the beginning of the line) the extensions that you want to enable them. I. e.
extension=php_curl.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
extension=php_soap.dll

Rest of the changes/deployments are totally depends on Requirement project wise.

 

Set environment variables for PHP/Apache (Windows 7)

Path in environment variables. Path Environment (System Properties | advanced | environment variables | system variables | path ).
Example:
; D: \ etc \ PHP; D: \ etc \ apache \ bin

 

Install Apache as service

Since we have just copied the files in a folder, the Apache is not yet not a Windows service. To install it as a service follow the steps.

  1. Run the command line (cmd.exe) as administrator. Browse the folder
    C: \ windows \ system32 \And right click onCmd.exeAnd select
    Run as Administrator.
  2. Change directory
    D: \ etc \ apache \ binIn the command line
cd d:\etc\apache\bin
  1. Run the command to install it
httpd -k install (or sometimes httpd.exe -k install if that does not work)

 

Now restart the computer and test both PHP and Apache. To test both together create a PHP File
Phpinfo. phpIn
D: \ etc \ www. Now browse in the browser
Http: // localhost/phpinfo. php.

Note:

To make sure the apache service is started, you need click
Right-click my computer-choose management-select service and application in the left column-select apache service again

 

MySQL
Download and install mysql-installer-community-5.5.29.0.msi. (http://dev.mysql.com/downloads/mysql)
Change installation directory to D:/etc/MySQL instead of program files as there cocould be permissions issues. once the installation is completed you can let the Configuration Wizard run and setup the database server. the defaults will work just fine,
Remember what you set the password to for root.

If it prompts current Root Password inputting, do not panic. You can reset it with
MySQL workbench.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.