Detailed explanation of wamp building example tutorial

PHP中文网
Release: 2023-03-10 20:46:02
Original
2318 people have browsed it

It’s been a long time since I set up an environment, and this time it went smoothly.

Let’s first review the principles of website operation.

OK, let’s get to the point. The wamp version of this environment is as follows:

Apache24: httpd-2.4.26-x64-vc11
php: php-5.6.30-Win32-VC11-x64
mysql:mysql-installer-community-5.5.56

1. The folder path is as follows:

(Because the default path in many places in the configuration file httpd.conf is Apache24, the folder name will not be changed for convenience)

2.Apache installation

  • Download and extract to Apache24

  • Prepare the Apache running environment Visual C++ 2012

  • Enter the command prompt Run the cmd run command to see if it can be run

  • Keep the cmd cursor flashing, that is, it is running. Test the address bar http://localhost. If the default homepage is displayed, it means it can run.

  • In most cases, we need to use Apache as a Windows server, so we need to install Apache

  • In cmd, under the above path, httpd -k install httpd -k start

  • This service has been added to the computer service.

  • In order to run the service through httpd.exe anywhere, you need to add environment variables. System---Advanced system settings---Environment variables.

3.PHP installation

  • Download and extract to the php folder, the nts version does not contain the php5apache2_4.dll file , cannot be loaded by Apache, select the ts version here.

  • In order to run php.exe in the cmd root directory, first set the environment variables.

  • After setting the environment variables, you can run the command php.exe -f php file path in the cmd root directory to run the PHP file, such as

    <?php 
    for($i=1;$i<=10;$i++){
        echo "$i";        
    }?>
    Copy after login

    In cmd mode,

    12345678910
    Copy after login

    *php will be displayed and can be run independently.

4. Configure httpd.conf, so that Apache can handle php

  • In the cmd root directory, check the modules loaded by Apache

    httpd.exe -M
    Copy after login
  • Add the following to the httpd.conf file:

    LoadModule php5_module D:/wamp/php/php5apache2_4.dll
    PHPIniDir "D:/wamp/php"
    AddType application/x-httpd-php .php .html .htm
    Copy after login

5. Configure php.ini so that it can load other modules

  • Copy php.ini-development- copy and rename it to php.ini

    修改时区
    date.timezone=PRC
    修改加载模块的路径
    extension_dir = "D:/wamp/php/ext"
    选择要加载的模块并去掉分号
    extension=php_mysql.dll
    extension=php_mysqli.dll等等
    Copy after login
  • You can also view the loaded modules of php

    php.exe -M
    Copy after login
    ## in the cmd root directory
    # 

6. Configure the virtual host

  • Modify httpd.conf and remove the #. Enable settings

    #Virtual hosts
     Include conf/extra/httpd-vhosts.conf
    Copy after login
  • Modify httpd-vhost.conf

    添加:
    <VirtualHost *:80>
        DocumentRoot "G:/color"
        ServerName color.com
        ErrorLog "logs/color.log"
        CustomLog "logs/color.log" common
    </VirtualHost> 
    Copy after login
  • Change httpd.conf The Require all denied comment is

    <Directory />
        AllowOverride none
      # Require all denied
    </Directory>
    缺少这一步,会显示 403 Forbidden
    Copy after login
     

## 7. Install mysql

    Download
  • (

    Select MSI Installer)

  • Installation is omitted.
  • Test whether it can run normally
  • C:\>net stop mysql
    MySQL 服务正在停止.
    MySQL 服务已成功停止。
    C:\>net start mysql
    MySQL 服务正在启动.
    MySQL 服务已经成功启动。
    Copy after login

    ## Log in to the mysql server
  • C:\>mysql.exe -hlocalhost -uroot -proot
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.5.56 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the current input statement.
    
    mysql>
    Copy after login

    means the login to mysql is successful.

    At this point, the environment has been basically set up. Restart apache command: httpd -k restart

The above is the detailed content of Detailed explanation of wamp building example tutorial. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template