Php 5.3.9 + apache 2.2.17 installation configuration tutorial

  

configuration PHP version is the latest php5.3.9, you can download the latest version from the official website, about the installation of MySql and Apache, this article will not repeat, the following main introduction MySQl 5.1, Apache 2.2 installation and mutual configuration.
First introduce the difference between the various versions of php, the php version generally has the difference between VC6 and VC9, Thread Safe and Non Thread Safe, VC6 is the legacy Visual Studio 6 compiler, which is compiled with this compiler, VC9 is The Visual Studio 2008 compiler is compiled with Microsoft's VS editor. If you choose Apache or other service software, then choose VC6, if you choose IIS, then please download VC9. Thread Safe is thread-safe, and Non ThreadSafe is non-thread-safe. The official does not recommend that you apply Non Thread Safe to production environments, so you can generally choose to download the Thread Safe version. Download the Zip package. Unzip the downloaded package, unzip it, rename it to PHP, I put it in the E drive, you choose according to your own situation, but in the following configuration process, the path is also subject to change. Open the folder after copying, find php.ini-development, rename it to php.ini, of course you can copy a copy of php.ini-development for backup to prevent irreparable errors during configuration. First, open php.ini, find: ; On windows:; extension_dir = "ext" Modify to: ; On windows:extension_dir = "E:/PHP/ext" That is to remove the semicolon in front of extension_dir (note the slash Direction), which specifies the specific directory of the PHP extension package to call the corresponding DLL file. Second, because the default PHP does not support automatic connection to Mysql, you need to open the corresponding extension library function, such as php_mysql.dll, etc., will be: extension=php_curl.dll //CURL, client URL library function library extension=php_gd2.dll //GD drawing function module extension=php_mbstring.dll //multi-byte function module extension=php_mysql.dll //MySql function module extension=php_mysqli.dll //MySqli function module extension=php_pdo_mysql.dll //PDO MySql function module extension=php_pdo_odbc .dll //PDO ODBC function module extension=php_xmlrpc.dll //XML-RPC function library extension=php_xsl.dll //XSL function module The semicolon (;) before these extensions is removed. Third, configure the PHP Session function When using the session function, we must configure the session file on the server to save the directory, otherwise you can not use the session, we need to create a new readable and writable directory folder on Windows7, this directory is best independent Outside the WEB main program directory, here I created the phpsessiontmp directory on the root directory of the D drive, and then found it in the php.ini configuration file: ;session.save_path = "/tmp" Modified to: session.save_path = " ; D: /phpsessiontmp " Fourth, the configuration of PHP file upload function is the same as session, when using the PHP file upload function, we must specify a temporary folder to complete the file upload function, otherwise the file upload function will fail, we still need Create a readable and writable directory folder on Windows 7, where I created the phpfileuploadtmp directory on the D root directory and found it in the php.ini configuration file: ;upload_tmp_dir = Change to: upload_tmp_dir = "D: /phpfileuploadtmp" V. Modify date.timezone, otherwise the date part of phpinfo is executed. Error: Warning: phpinfo()[function.phpinfo]… Found: ;date.timezone = Modified to: date.timezone = Asia/Shanghai So far, the environment configuration of php on Windows 7 is complete, but the completion of these configurations is Not enough, we need Apache to support PHP, so we need to complete the corresponding PHP configuration in the Apache configuration file. “register_globals = Off” value, this value is used to open global variables, such as the value sent by the form, if this value is set to “Off”, you can only use “$_POST['variable name'], $_GET['variable name']” etc. to get the value sent, if set to “On”, you can directly use the “$variable name” to get the value sent, of course, set to “ Off” is safer and does not make it easy to intercept data transmitted between web pages. Whether this value is changed to "On"; On the rd, it is safe or important to see if you feel it? The following is to configure Apache to support PHP: Find httpd.conf in the conf folder under the Apache installation directory, open: First, add the following under #LoadModulevhost_alias_modulemodules/mod_vhost_alias.so (the path depends on your own situation): LoadModule php5_module "c:/php/php5apache2_2.dll"PHPIniDir "c:/php"AddType application/x-httpd-php .php .html .htm We can see multiple php5apache DLL files in the PHP directory, due to us I am using Apache 2.2.17, so of course we need to make php5apache2_2.dll, then specify the PHP installation directory and the program extension to execute.


Second, we should know that the default Apache server to execute the WEB main program directory is Apache2.2/htdocs, so when your WEB main program directory changes, we need to modify the corresponding Apache configuration, namely: DocumentRoot " ;D:/Program Files/Apache Software Foundation/Apache2.2/htdocs" Amended to: DocumentRoot "E:/PHPWeb" Order: <Directory "D:/Program Files/Apache Software Foundation/Apache2.2/Htdocs"> is modified to: <Directory"E:/PHPWeb"> Third, the final revision of the specific index file sequence: DirectoryIndex index.html Modified to: DirectoryIndex index.phpindex. html Fourth, restart the Apache server to this point, in The PHP environment configuration on the Apache server is complete. You only need to create a new PHP file in the E:/PHPWeb directory and write: <?php phpinfo(); ?> Then enter 12.0.0.1 in the browser. You can see the specific configuration page of PHP, which means that the PHP environment configuration work on Window 7 is completed. . To verify that PHP can connect to Mysql, you can create the following code in index.php: <?php$connect=mysql_connect("127.0.0.1","root","your database password"); If(!$connect) echo "Mysql Connect Error!";else echo "Connection success";mysql_close();?> Then enter 127.0.0.1 in the browser and see: the connection is successful PHP connection to Mysql is a success.

Copyright © Windows knowledge All Rights Reserved