Under Windows Apache build PHP development environment, Apache build
This article describes in detail the use of apache2.2.21/php5.3.5/mysql5.5.19/phpmyadmin3.4.9 to build PHP development environment under WINDOWS2003.
First step: Download the installed files
1. Apache version Httpd-2.2.21-win32-x86-no_ssl.msi
2. MySQL version Mysql-5.5.19-win32.msi
3. PHP version Php-5.3.5-win32-vc6-x86.zip
4. PhpMyadmin version Phpmyadmin-3.4.9-all-languages.zip
1. It is recommended to select the Apache version without SSL to complete the development, so we use Apache 2.2.21-win32-x86-no Ssl.msi here.
2. Install MySQL under Windows Select the. msi installation package format, we chose Mysql-5.5.19-win32.msi, double-click the wizard to install, simple and convenient.
3. PHP we choose to use the. zip version of Windows, Php-5.3.5-win32-vc6-x86.zip. From the security and performance of the zip version is good, the general server is also installed this version.
Do not download the NTS version or the VC9 version, because VC9 is specifically customized for IIS, and VC6 is for Apache or other Web services software.
4. phpMyAdmin is a PHP-based online MySQL management tool, the PHP environment required for phpMyAdmin3 installation is at least php5.2,mysql5 or more, we meet the requirements here.
Step Two: Install files
1. Build a folder on the disk that you want to install. For administrative convenience we create a Wamp folder in the root directory of the D drive. D:\WAMP (WAMP is the abbreviation for windows+apache+mysql+php).
2. Create a WWW folder under the Wamp folder to store your PHP website program. D:\WAMP\WWW.
3. Install the Apache server and install the Apache server to the D:\WAMP\Apache folder. The specific Apache installation process can refer to the documentation Apache installation diagram.
4. Extract the downloaded php-5.3.5-win32-vc6-x86 to the D:\WAMP\PHP folder.
5. Install MySQL database and install MySQL to the D:\WAMP\MySQL folder. The specific MySQL installation process can refer to the documentation for the MySQL installation diagram.
6. Unzip the phpmyadmin-3.4.9-all-languages.zip, then rename it to phpMyAdmin, and copy it to the PHP website program directory. The result is D:\WAMP\WWW\phpMyAdmin.
Step Three: Configure Apache
First use the text Editing tool (recommended EditPlus) to open the D:\WAMP\Apache\conf\httpd.conf file, this file is the Apache configuration file, the following steps are to modify the contents of this file.
Note that the httpd.conf file needs to be restarted to restart the Apache service and the new settings will not take effect.
1. Setting the Listening port
After opening the httpd.conf file, locate Listen (probably on line 46th) and change the number after it to 8080, as follows:
This parameter is used to set the Apache server's listening port, which typically defaults to 80. The change to 8080 is to avoid conflicts with IIS port numbers for Windows 2003 systems, and you can use the default 80 port number if you do not have IIS enabled.
2. Let Apache load the PHP module
Locate the #LoadModule vhost_alias_module modules/mod_vhost_alias.so (probably on line 128th) and add the following after this line:
LoadModule php5_module "D:/wamp/php/php5apache2_2.dll" AddType application/x-httpd-php. PHP phpinidir "D:/WAMP/PHP" LoadModule php5_module "D:/wamp/php/php5apache2_2.dll"
This means loading the PHP5 module in modules mode.
AddType application/x-httpd-php. php
This means that the. php extension file is executed as a PHP script. You can use any other extension you like, such as. html,. php5, or even. txt to execute PHP.
This is used to specify the directory where the PHP configuration file php.ini resides.
If Apache 2 is running PHP5 in module mode, you can use the Phpinidir command.
3. Modify the Site Storage directory
We know that the Apache Default Web hosting directory is the Htdocs folder under the Apache installation directory. When you change the Web hosting directory, you must modify the appropriate Apache configuration.
Look for DocumentRoot (approximately 182 lines) in profile httpd.conf and modify it to the correct folder for the site directory. We'll change here.
Also, look for this should is changed to whatever you set DocumentRoot to (about 207 lines), there are lines below it, modify it to your own configured DocumentRoot path. We have modified here to:
4. Modify the Directory home page file
Look for DirectoryIndex index.html (approximately 244 lines) in the configuration file httpd.conf to modify it to:
DirectoryIndex index.html index.htm index.php
DirectoryIndex refers to the file that Apache performs by default when the path that the client browser accesses is a directory.
For example: When the client browser accesses a directory, Apache will go to find the index.html in that directory, and if you don't find index.htm again, you haven't found index.php. is not found, the list of files in this directory is displayed by default. Reference Document: If you prevent Apache from displaying a list of files
Fourth Step: Configure PHP
Open the PHP installation directory, that is D:\WAMP\PHP, we can see that there are two such files in the directory Php.ini-development and Php.ini-production, the first one is the configuration file used for development, the second is the configuration of the production environment, because we are doing the development in this machine, so choose the former. Copy the php.ini-development to the same directory and rename it to PHP.ini. This php.ini is the currently used configuration file, the following steps are to modify the contents of this php.ini file. Note that the Apache service needs to be restarted after modifying the php.ini file, and the new settings will not take effect.
1. Specify a storage directory for the PHP extension library
PHP's extension libraries under windows are usually stored as DLLs in the PHP ext directory.
Use the Text tool to open the php.ini file and look for extension_dir = "ext" (approximately 809 lines), which is the line below on Windows. Put it in front of the semicolon ";" Removed and changed to read as follows:
Extension_dir = "D:/wamp/php/ext"
Extension_dir represents the specific directory of the PHP extension library in order to invoke the appropriate DLL file.
2. Open the appropriate extension library
By default, many PHP extension libraries are closed, such as the default PHP does not support the connection to the MySQL database, you need to open the appropriate extension library.
Here we open some of the commonly used extension libraries.
Find Windows Extensions (about 941 lines), below it is the list of extension.
Find the following extensions:
Extension=php_curl.dll; extension=php_gd2.dll; extension=php_mbstring.dll; extension=php_exif.dll; extension=php_ Mysql.dll; extension=php_mysqli.dll; extension=php_pdo_mysql.dll; extension=php_pdo_odbc.dll; extension=php_ Sockets.dll, Extension=php_xmlrpc.dll, Extension=php_xsl.dll
Get rid of the semicolon ";" in front of the above extension. If you want to load other extensions, the method is the same, just remove the preceding semicolon.
Tip 1: Restart the Apache hint "Unable to load dynamic Library......php_curl.dll", loading the Php_curl.dll error. The workaround is to copy the Libeay32.dll and Ssleay32.dll in the PHP directory to the Windows directory or Windows/system32 directory, as long as the path contained in the system PATH environment variable is available. If you do not want to copy, you can also directly put the PHP path in the system PATH environment variable. Right-click my Computer = = Property = = Advanced = Environment variable = = System variable has a path, double-click Open, add your PHP path a semicolon ";" In front (;D: \wamp\php), add in is OK. Restarting Apache no longer prompts for this error.
Tip 2: The EXIF extension is used to display EXIF information for a picture, because the extension requires Mbstring.dll support, so the Extension=php_exif.dll line must be written to Extension=php_ Behind the Mbstring.dll.
Tip 3: If PHP comes with an extension library that doesn't meet your needs, you can go to pecl.php.net to find and download the library you need. Windows users can go to pecl4win.php.net or http://downloads.php.net/pierre/to download the compiled DLL files, you can go to http://museum.php.net/php5/ Load PECL set of compressed packets.
Tip 4: A lot of people looking for php_zip.dll, in fact, from the beginning of the php5.3 has been integrated zip extension, direct use on the line. You can find the description of the zip extension with <?php phpinfo ()?>.
3. Let PHP support short tags
In the php.ini configuration file, look for short_open_tag = OFF (approximately 266 lines) to modify it to: Short_open_tag = on to enable it to support short tags.
PHP code is generally included in the <?php ... > in the label, set Short_open_tag = On, can be written in a more concise form: < .... ? >.
4. Configure the session function of PHP
When using the session function, we must configure the session file to save the directory on the server. We need to create a read-write directory for the session, preferably independent of the site directory.
Here the directory is built in the D:\WAMP\sessiontmp, and then in the php.ini configuration file, Session.save_path = "/tmp" (about 1467 lines), remove the preceding semicolon ";", instead, as follows:
Session.save_path = "D:/wamp/sessiontmp"
5. Configure the PHP file upload function
As with the session, when using PHP file Upload function, we must specify a temporary folder to complete the file upload function, or the file upload function will fail.
We create a read-write directory folder D:\WAMP\fileuploadtmp, which is then found in the php.ini configuration file, Upload_tmp_dir = (approximately 875 lines), modified to:
Upload_tmp_dir = "D:/wamp/fileuploadtmp"
PHP default upload file size of not more than 2M, to upload files larger than 2M, please refer to the document configuration PHP.ini implementation file upload function.
6. Set the time zone
In the php.ini configuration file find;d Ate.timezone = (approximately 993 lines), remove the preceding semicolon ";" to read as follows:
Date.timezone = PRC
Date.timezone is a newly added configuration parameter for PHP5.1 to set the time zone. The default Date.timezone is commented out, and the default time zone is UTC Greenwich Mean time.
We changed here to Date.timezone = PRC (Prc,people's Republic of China, People's Republic of China), which is the date used in the Chinese time zone. This solves the problem of a time difference of eight hours.
Fifth Step: Configure phpMyAdmin
Open the PhpMyAdmin directory, that is, D:\WAMP\WWW\phpMyAdmin, we can see the directory has a config.sample.inc.php file, copy this file to the same directory, and renamed to Config.inc.php. This config.inc.php is the phpMyAdmin configuration file, the following steps are to modify the contents of this config.inc.php file.
1. Set phpMyAdmin login mode
Open the config.inc.php file to find $cfg [' Servers '] [$i] [' Auth_type '], set as follows:
$cfg [' Servers '] [$i] [' auth_type '] = ' cookie ';
The value of this parameter is set to a cookie, and the user name password is required for each login phpMyAdmin. This is also the default setting for phpMyAdmin.
Then find the $cfg [' Blowfish_secret '], set as follows:
$cfg [' blowfish_secret '] = ' admin10000.com ';
This parameter is used for the encryption of cookies, which is set to admin10000.com and you can change it to your own password.
Here are four ways to log in to phpMyAdmin:
Cookie: This is the default login method for phpMyAdmin configuration. You will need to enter your MySQL admin account and password at the login screen.
When you choose the cookie login method, you also need to set the phrase password $cfg [' Blowfish_secret '], which is used for the encryption of cookies.
For example: $cfg [' blowfish_secret '] = ' admin10000.com ';
If not set, login phpMyAdmin will prompt the "profile now requires a phrase password" error.
Config: Enter the phpMyAdmin login address directly in the address bar of the ground browser to log in and anyone can access it. The user name and password are set in advance in the configuration file.
This sign-in method must add the following 2 lines of parameters to the configuration file:
$cfg [' Servers '] [$i] [' user '] = ' your MySQL login account ';
$cfg [' Servers '] [$i] [' password '] = ' your MySQL login password;
If only in the development of this machine, can be set to config login mode, eliminating the hassle of entering the password every time.
http: Popup A dialog box, enter the user name and password.
Signon: Similar to the page Jump login method, also need to set $cfg[' Servers ' [$i] [' Signonurl '], when you enter the phpMyAdmin login address will automatically jump to Signonurl set URL.
2. Turn on phpMyAdmin advanced features
After logging in to PhpMyAdmin, you will be prompted at the bottom of the first page: "PhpMyAdmin advanced features are not all set and some features are not available."
Now let's solve the problem. Using the phpMyAdmin Import feature, import the Phpmyadmin/scripts/create_tables.sql file to create the necessary data tables.
The next step is to create a new MySQL user and give it access to the data tables established in the previous operation, which is called the control user and provides support for PhpMyAdmin advanced features.
We use the PMA here as the control user and Pmapass as the password for the control user. You can change it yourself.
Enter the following SQL code in the phpMyAdmin SQL query function box:
We then found the line in config.inc.php with the User used to manipulate with storage. Remove the 2-line parameter comment (double slash "//") below it.
The result is:
$cfg [' Servers '] [$i] [' controluser '] = ' PMA '; $cfg [' Servers '] [$i] [' controlpass '] = ' pmapass ';
These two lines are control user and control user password respectively. That is the user we created above.
Then find Storage database and tables this line, the following several parameters of the comments removed. The result is:
$cfg [' Servers '] [$i] [' pmadb '] = ' phpmyadmin '; $cfg [' Servers '] [$i] [' bookmarktable '] = ' pma_bookmark '; $cfg [' Servers '] [$i] [' relation '] = ' pma_relation '; $cfg [' Servers '] [$i] [' table_info '] = ' pma_table_info '; $cfg [' Servers '] [$i] [' table_coords '] = ' pma_table_coords '; $cfg [' Servers '] [$i] [' pdf_pages '] = ' pma_pdf_pages '; $cfg [' Servers '] [$i] [' column_info '] = ' pma_column_info '; $cfg [' Servers '] [$i] [' history '] = ' pma_history '; $cfg [' Servers '] [$i] [' tracking '] = ' pma_tracking '; $cfg [' Servers '] [$i] [' designer_coords '] = ' pma_designer_coords '; $cfg [' Servers '] [$i] [' userconfig '] = ' pma_userconfig ';
Sixth step: Test
Save the following code as a index.php file, and put it under the D:\WAMP\WWW directory.
Test server <?php $link =mysql_connect ("localhost", "your MySQL admin account", "your MySQL admin password"); if (! $link) echo "MySQL database connection failed!"; else echo "MySQL database connection succeeded!"; Mysql_close ();?>
Then enter "http://localhost:8080/index.php" in the browser address bar. The results are as follows:
http://www.bkjia.com/PHPjc/1049121.html www.bkjia.com true http://www.bkjia.com/PHPjc/1049121.html techarticle under Windows Apache build PHP development environment, Apache build this article describes in detail the use of apache2.2.21/php5.3.5/mysql5.5.19/under Windows2003 phpMyAdmin3.4.9 Build PHP development environment. The first step: ...