Apache服务器 + PHP + MySQL

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.

Installing AMP (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 configuring them each in your own way because they will present some user interface where you can directly do configurations by one click. You will not know what exactly required for changing something in Apache, PHP or MySQL. So to have knowledge on configurations on them according to your requirement, you have to install each application individually.

The installation and configurations of PHP, Apache and MySQL in Windows has also become quite easier these days because they provide some default configurations. As PHP, after its latest releases i.e.5.4, does not provide the 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 with 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 byApache Lounge (apachelounge.com)not the original Apache (apache.org). Since I haven’t worked 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 myD drive. The folder structure will look like below:

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

DownloadDownload the latestApache 2.4.3 (as of writing this) from (direct link for the current version – ) and unzip it in d:/etc/apache. I do not use the OpenSSL one here.Download the archive version 5.4.9 from) 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.Download php5apache2_4.dll-php-5.4-win32.zip for the PHP and Apache connector DLL file and extract the file php5apache2_4.dll and copy it to d:/etc/php.Configurations

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

ApacheOpen the file d:/etc/apache/conf/httpd.confin any text editor (I use my lovely Notepad++) then find and make the following changes/configurations as per your installation path.Set the server rootServerRoot "D:/etc/apache"Enable required Apache modules. I just uncomment one more formod_rewrite module.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 .phpPHPIniDir "d:/etc/php"Change server admin email addressServerAdmin info@yoursite.comChange the document root:DocumentRoot "d:/etc/www"<Directory "d:/etc/www">If you want to allow .htaccess ("分布式配置文件")to be used under document root do the following under <Directory “d:/etc/www”>AllowOverride AllFind the follwoing and replace the path:ScriptAlias /cgi-bin/ "d:/etc/apache/cgi-bin/"<Directory "d:/etc/apache/cgi-bin">Add index.php in directory index

DirectoryIndex index.html index.php

PHPRename php.ini-development to php.iniFind extension directory setting and set the path as per your installation.extension_dir = "d:\etc\php\ext"Uncomment (remove the simicolon; from the beginning of the line) the extensions that you want to enable them. i.e.extension=php_curl.dllextension=php_mysql.dllextension=php_mysqli.dllextension=php_pdo_mysql.dllextension=php_soap.dll

Rest of the changes/configurations are totally depends on requirement project wise.

Set Environment Variables for PHP/Apache (Windows 7)不能接受失败,也意味太想去成功了,从心理学上解释,

Apache服务器 + PHP + MySQL

相关文章:

你感兴趣的文章:

标签云: