Construction of PHP development environment based on Windows environment

Source: Internet
Author: User
Tags ini mysql pear php file php development environment php programming win32 phpmyadmin

I believe many people and I like, are very fond of learning PHP programming, but also many people because they can not build a Windows environment based on the PHP development environment to build and have to give up their own learning PHP desire. So I would like to write their own experience on this issue, one can help those who suffer from the inability to build a development environment, and two can let themselves have a summary of the opportunity.

The purpose of my writing this article is simply to help those friends who are just starting to learn PHP, so I will try to describe it in the simplest and most specific language, and if you have been very skilled in this matter, you can do more meaningful things without looking at this article.

Limited to my own level, this article inevitably has errors and deficiencies, please advise.

Note: This article does not cover server security and optimization issues. If you have such a problem, you can access the security focus site and search for articles published by the security Focus member SAN.

Before we begin the formal explanation, let's start by introducing the software you need to build your PHP environment. Because we're explaining the development environment in a Windows environment, you must have a PC with Windows as the operating system. Here is the specific development environment on my machine:

Operating system: Windows XP SP2

Required Software: Php:php-4.4.0-win32.zip

Mysql:mysql-noinstall-4.1.14-win32.zip

Apache:apache_2.0.54-win32-x86-no_ssl.msi

Phpmyadmin:phpmyadmin-2.6.4-pl1.zip

Source of software: Windows:microsoft

php:http://www.php.net/

mysql:http://www.mysql.com/

apache:http://www.apache.org/

phpmyadmin:http://www.phpmyadmin.net/

OK, when you download and have the above software, we can start our installation configuration tour.

  Configure PHP

Unzip the Php-x.x.x-win32.zip to the C-packing directory. After the decompression is completed, we should be able to find a folder named Php-x.x.x-win32 in C-packing directory and rename it to PHP. Entering this folder, we can see several folders and several files. Let me explain a few of the directories and files that were used at the time of configuration.

[DLLs] holds the required DLLs for the corresponding PHP extension library. So what is PHP's DLL extension library? It is an extension of PHP's basic functionality. For example, you need to use PHP to generate images, then you have to use the GD Library extension, the library contains a series of image generation functions. In this way, you can easily expand the scope of PHP application. So when you configure PHP you need to tell PHP that you need support for the extension library.

[extensions]php dll for the extension library. This is the location of the PHP Search extension library and the repository for the extensions.

[Pear]pear is the repository path for PHP extensions and application libraries (PHP Extension and application Repository). More accessible http://pear.php.net understand.

[SAPI] holds the SAPI DLL file.

[Go-pear.bat] Installs the files required by pear.

[Install.txt] Installation documentation.

[Php4ts.dll] Main DLL file.

[php.exe]cgi executable program.

[php.ini-dist]php configuration file

See here always make people feel difficult, in fact, here instead of simple, the following is more specific explanation, as long as you pay attention to the installation steps, do not make a mistake, success is not far from you. Oh, come on!

The first step: Copy the Php4ts.dll file to the C:\Windows\ directory (if it is the Windows 2000/nt operating system, the C:\winnt\ directory, the same below.) Please note the corresponding folder for your Windows version.

Step Two: Copy all the. dll files under the [DLLs] folder to the C:\Windows\system32\ directory (the C:\winnt\system32\ directory if it is the Windows 2000/NT operating system; If it is Windows 98, the is the C:\windows\system\ directory. Same Please note the corresponding folder for your Windows version.

Step three: Copy the Php.ini-dist file to the C:\Windows\ folder and rename it to PHP.ini. Here is a reminder: Do not store php.ini files in the PHP directory. That means the C:\PHP directory does not have a php.ini file (this will not happen if you follow my steps for a new installation of PHP). Now that we have the php.ini file in the C:\windows\ directory, this file is a PHP configuration file, so configuring PHP is also centered around it. Open it in Notepad, and configure it in order from top to bottom.

Path and directories: Sets the PHP file search path. Modify it to:

; Unix: "Path1:/path2"

; include_path= ".:/ Php/includes "

;

; Windows: "\path1;\path2"

Include_path= "C:\PHP\PEAR\"

Extension_dir: Sets the location of the PHP Search extension library. Point its path to: C:\PHP\extensions\

File uploads: Set the size of files that PHP allows to upload (default 2M)

Dynamic extensions:php Extended configuration section. Here is a list of all of the support extensions for PHP, preceded by a semicolon annotation, indicating that the current PHP configuration does not support the extension, you can remove the semicolon according to your specific needs to enable the PHP configuration to support the extension.

The more practical extensions include:

Extension=php_curl.dll:curl Extended Support

EXTENSION=PHP_GD2.DLL:GD Image Library Extended Support

EXTENSION=PHP_XSLT.DLL:XSLT extension support, which supports conversion to XML.

  Installation of Pear

Click: Start-"Run, enter CMD, continue typing in Windows command Prompt window cd\

C:\

C:\>CD PHP

C:\php>

C:\php>go-pear.bat

The rest is all the way to enter, hehe.

  installation of MySQL

Unzip the Mysql-noinstall-4.1.14-win32.zip folder and place it in the C-packing directory. Enter the [bin] directory, run Mysqld-nt.exe, and open the MySQL service.

Note: The default installed MySQL root username is not password, this is a very dangerous thing, so please give him a password.

  Apache Installation and Configuration

Installation and installation of general software is nothing different, adding server information generally add localhost. After installation, enter the [Htdocs] directory and open the httpd in the [conf] directory. conf file, start our Apache tour.

1, search location to: DirectoryIndex index.html Index.html.var

After adding the index.php, add the following:

DirectoryIndex index.html Index.html.var index.php

2, search location to:

<diretory "C:/Program files/apache group/apache2/cgi-bin" >

AllowOverride None

Options None

Order Allow,day

Allow from all

</Diretory>

Then add the following two lines:

AddType application/x-httpd-php. php. phtml php3. PhP4

AddType Application/x-httpd-php-source. Phps

Added later as follows:

<diretory "C:/Program files/apache group/apache2/cgi-bin" >

AllowOverride None

Options None

Order Allow,day

Allow from all

</Diretory>

AddType application/x-httpd-php. php. phtml php3. PhP4

AddType Application/x-httpd-php-source. Phps

3, search location to:

#LoadModule Ssl_module modules/mod_ssl.so

Add below it:

LoadModule Php4_module C:/php/sapi/php4apache2.dll

You should add the following:

#LoadModule Ssl_module modules/mod_ssl.so

LoadModule Php4_module C:/php/sapi/php4apache2.dll


Here the Apache server configuration can be ended, save the httpd.conf file, restart the Apache server.

The test server was successfully installed and we can use the following code:

<?php phpinfo ();?>

Save it as a phpinfo.php file, put it in the Htdocs directory, and enter the following address in the browser's address bar: http://localhost/phpinfo.php, you will see the information.

Based on the Windows environment of the PHP development environment to build this all over. Welcome you to enter the PHP study, the development!



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.