apache + php + mysql windows environment configuration under

It should be noted that the current apache and php and mysql should use 32-bit, 64-bit machine is also installed 32. Before I installed the 64-bit version, problems always arise. Return to the topic:

Software needed:

1.apache: Quguan network download, here I use the httpd-2.4.12-x86-r2.zip

2.php: go to the official website to download the same, here I use the php-5.4.40-Win32-VC9-x86.zip

3.mysql: The same official website to download, mysql 5.1 I use (you can use a higher version)

1.apache:

     You only need to unpack both to the appropriate directory, for example, I am here to download the apache extract the files to C: \ Apache24:

     Bin directory are:

     ApacheMonitor.exe and httpd.exe can be used to open and close the service. After opening service if http: // localhost have page appears, it shows a successful installation apache (port 80 by default, generally have a problem, then the problem is the port)

     htdocs directory:

     This directory is the page of our website such as (.html, .php), according to HTTP: //localhost/hello.php (Let's say there is a hello.php the directory)

    conf directory:

    http.conf is the configuration file, many things need to be configured (such as php, mysql) in this document, we will detail below.

2.php:

     Also you only need to unzip the downloaded file to the appropriate directory, E: \ php

    There are php-ini-development and php.ini-production php directory files. Just rename it to php.ini as a configuration file.

3.mysql:

      mysql need to install, the installation steps on the shining point down on it, remember to set the root password.

 

  To make Apache support php, mysql, we need to add a few things:

   1. In the Apache module file is loaded following http.conf add the following text:

      LoadModule php5_module "E: /php/php5apache2_4.dll" (you can extract the appropriate directory php)
     AddType the Application / the X-httpd-php .php .phtml-
     PHPIniDir "E: / php /"

   2. In the php.ini file, modify:

      extension=php_mysql.dll

      extension=php_mysqli.dll

     Foregoing; removed (about 880 lines almost re)

  3. Write a php page, placed under the apache htdocs directory named hello.php:

<?php

$link = mysql_connect('127.0.0.1', 'root', '123456','gjs');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

If an error can be viewed: C: \ Apache24 \ log files in the logs:

Such as the emergence mysql not connect:

   Call to undefined function mysql_connect() in C:\\Apache24\\htdocs\\hello.php on line 7

Php mysql is not loaded good parts, you said earlier check; there is not removed, and the configuration file is correct, it is possible to find file php.ini path, etc. (in the system environment variable path which added to extract the path of php), to ensure that the installation is 32-bit, basically it, there are questions you can contact me.

Reference: http: //gbzgwd.com your Baozhai | your Bao Zhai antique artifacts Exchange

 

Reproduced in: https: //www.cnblogs.com/GuoJiaSheng/p/4505165.html

Guess you like

Origin blog.csdn.net/weixin_34331102/article/details/93614770