php环境搭建-WNMP(Win7+NGINX+MYSQL+PHP)
【引言】
php开发环境对于每个phper来说,应该像呼吸一样,不应该是很困难的事。下面我教大家怎么搭建php环境,也是我自己的一个总结,希望能和大家一起提高。(希望大家不吝分享,不要藏私哦)
【准备工作】
准备工作开始,首先查看自己电脑是多少位的操作系统(不会问度娘),我的电脑是64位Win7操作系统,我就以64位为例
php版本:php-5.6.15-Win32-VC11-x64.zip php下载地址
nginx版 :nginx-1.8.0.zip nginx1.80下载地址
mysql版:mysql-5.6.27-winx64.zip mysql下载地址
建立环境目录,个人喜欢把环境的东西放在D盘,所以在D盘目录下建立"wnmp",目录里面分别建四个文件夹 1.mysql 2.nginx3.web 4.php
【安装环境】
1.nginx
把下载好的nginx-1.8.0.zip,解压缩到 D:\wamp\nginx
2.php
下载好的php-5.6.15-Win32-VC11-x64.zip,解压缩到 D:\wamp\php
3.mysql
把下载好的php-5.6.15-Win32-VC11-x64.zip解压缩到 D:\wamp\mysql
【配置环境】
1.php配置
改天再整理
2.nginx配置
改天再整理
3.mysql免安装版配置
解压缩php-5.6.15-Win32-VC11-x64.zip到d:/wamp/mysql
将解压目录下默认文件 my-default.ini 拷贝一份,改名 my.ini 并复制下面的信息到my.ini
****************************************************************************************************************************************
[client]
port=3306
default-character-set=utf8
[mysqld]
port=3306
character_set_server=utf8
basedir=D:\wamp\mysql
#解压目录
datadir=D:\wamp\mysql\data
#解压目录下data目录
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[WinMySQLAdmin]
D:\wamp\mysql\bin\mysqld.exe
*****************************************************************************************************************************************
4. 添加环境变量
操作如下:
1)右键单击我的电脑->属性->高级系统设置(高级)->环境变量
点击系统变量下的新建按钮
输入变量名:MYSQL_HOME
输入变量值:D:\wnmp\mysql
#即为mysql的自定义解压目录。
2)选择系统变量中的Path
点击编辑按钮
在变量值中添加变量值:%MYSQL_HOME%\bin
注意是在原有变量值后面加上这个变量,用;隔开,不能删除原来的变量值,
5. 运行cmd进入D:/wamp/mysql/bin 安装mysql系统服务,安装成功后会提示服务安装成功。
安装服务命令:mysqld install MySQL --defaults-file="D:\wnmp\mysql\my.ini"
#移除服务命令为:mysqld remove
【启动环境】
1.创建文件 start_gbk_server.bat
@echo off & title 启动Nginx服务器
color 0A
REM Windows 下无效
REM set PHP_FCGI_CHILDREN=5
call stop_server.bat
REM 每个进程处理的最大请求数,或设置为 Windows 环境变量
set PHP_FCGI_MAX_REQUESTS=1000
echo 启动 php-5.4.19 FastCGI ...
RunHiddenConsole.exe D:/wnmp/php/php-cgi.exe -b 127.0.0.1:9000 -c "D:/wnmp/php/php.ini"
echo 启动 Nginx 1.6.3
RunHiddenConsole.exe D:/wnmp/nginx/nginx.exe -p D:/wnmp/nginx
echo 启动 Mysql 5.6
RunHiddenConsole.exe net start mysql
echo 启动完成...
2.创建文件stop_bgk_server.bat
@echo off & title Nginx
color 0A
echo Stopping Nginx...
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe > nul
echo Stopping Mysql
net stop mysql
【测试环境】
在D:/wnmp/web目录下建index.php 内容如下:
phpinfo();
?>
在C:\Windows\System32\drivers\etc 西面找到hosts文件用记事本打开 然后写上如下hosts:
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 www.example.com
在浏览器中打开 www.example.com如果出现如下图证明php环境搭建成功,如果不成功再调试

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.
