Home >Backend Development >PHP Tutorial >Teach you how to build a PHP development environment with WinXP_PHP Tutorial
Build a PHP development environment on WinXP 1. Install the Apache server
Address: http://httpd.apache. org/download.cgi
Download the current new version: apache_2.2.13-win32-x86-openssl-0.9.8k.msi
Just run the installation file directly.
The installation path in this example: D:Program FilesApache Software FoundationApache2.2
Build a PHP development environment on WinXP 2. Install PHP
The latest stable one The version is PHP 5.2.11, but there is no corresponding PECL package. The 5.2.6 PECL package can still run on this version. I also chose to use version 5.2.6. Download address: http://www.php.net/releases/
Download two files: php-5.2.6-Win32.zip, pecl-5.2.6-Win32.zip. The first file is the PHP interpreter, and the second is PECL (The PHP Extension Community Library), which contains C language code that can be compiled into PHP Core, so the PECL extension library can be compiled into a dynamically loadable .so A shared library that extends the PHP language from the bottom up.
Extract the two compressed files and copy all dll files under pecl-5.2.6-Win32 to the ext directory under php-5.2.6-Win32. Then put php-5.2.6-Win32 where you want it. The PHP core interpreter is installed successfully.
Installation path in this example: D:Program FilesPHPphp-5.2.6-Win32
Two files need to be modified:
1) PHP configuration file. There are two built-in files in the PHP installation path: php.ini-dist and php.ini-recommended. Let's modify the first one, make a copy of the first file and change the name to php.ini.
Modify: extension_dir item, which specifies the location of the extension dll directory. Change to: extension_dir = "D:/Program Files/PHP/php-5.2.6-Win32/ext"
doc_root item, which specifies the path of the web server. Change to: doc_root = "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
Enable certain extensions. Some already exist, but have been commented out. Just replace the ; sign before the line. If you don't know which ones you will use, you can skip this step for now.
2) Apache configuration file. Add PHP to Apache configuration. Modify the httpd.conf file in the conf in the Apache installation directory and add the following statement:
LoadModule php5_module "D:/Program Files/PHP/php-5.2.6-Win32/php5apache2_2.dll"
PHPIniDir "D:/Program Files/PHP/php-5.2.6-Win32/"
AddType application/x-httpd-php .php
It should be noted that "D :/Program Files/PHP/php-5.2.6-Win32/php5apache2_2.dll" must use double quotes, otherwise Apache cannot start the service.
Build a PHP development environment on WinXP 3. Test the installation.
Create a test file test.php in the directory of the Apache server
File content: phpinfo() ?>
Start the server, Visit http://127.0.0.1/. All configuration information of PHP will be printed.
4. Install PEAR.
Just run the go-pear.bat command in the PHP directory. Just press Enter during the installation process. PEAR is PHP's official open source class library, the abbreviation of PHP Extension and Application Repository. Pear means pear in English. PEAR compiles commonly used functions in the PHP program development process into class libraries, covering many aspects such as page rendering, database access, file operations, data structures, cache operations, network protocols, etc., and can be used easily by users.
Build a PHP development environment on WinXP 5. Configure the environment variables and add the PHP installation directory to the path.
Otherwise, some functions supported by PHP cannot be found, such as the libmysql.dll file related to supporting MySQL. If you search online, some people will tell you to copy this file to the window directory. To solve the same problem, setting path is obviously more professional.
Building a PHP development environment on WinXP 6. The editor I chose is Zend, and Eclipse also has a dedicated PHP editor.
Zend will start to use Eclipse plug-in technology for development after 7.0. The style is the same as Eclipse. I don’t know if it is to attract a large number of Java developers.
Build a PHP development environment on WinXP 7. If you use Zend, put the code of the PHP project in the workspace.
php is not a programming language, just a script, and does not need to be compiled. Therefore, you can configure Apache's project release directory to the workspace, so that you can see the results after writing the code, which is very convenient.
That is, modify the DocumentRoot item in the conf/httpd.conf file in the Apache installation directory to the location of the workspace.