Windows Server 2012上PHP运行环境搭建的简易教程(Win08适用)
微软的Windows Server 2012发布后,第一时间进行了简单的试用,非常不错,特写了个简易的PHP环境搭建教程。 先来欣赏下Win2012的登录界面吧 第一步我们需要安装IIS8 1、点击任务栏最左边第一个图标,打开任务管理器,会看到一个“添加角色和功能”的入口,点
微软的Windows Server 2012发布后,第一时间进行了简单的试用,非常不错,特写了个简易的PHP环境搭建教程。
先来欣赏下Win2012的登录界面吧
第一步我们需要安装IIS8
1、点击任务栏最左边第一个图标,打开任务管理器,会看到一个“添加角色和功能”的入口,点开
2、选择“基于角色或基于功能的安装”,然后点击下一步
3、在服务器选择界面选择当前服务器,并点击下一步
4、服务器角色选择界面我们选择IIS,并点击下一步
5、接下来需要连续多点两次下一步,然后来到“角色服务”选择界面,如果你只是单纯的运行PHP站点的话,这里仅需要在默认选择的基础上多选一个“CGI”选项即可,具体如下图所示
6、接下来就开始安装了,安装好之后我们可以打开IIS管理界面
第二步我们安装PHP运行环境
需要做一些准备工作,我们这里安装PHP5.3.24,并添加微软的PHP加速器Wincache,经我手头不少服务器实际验证会发现,Wincache稳定性和性能都不错,能为PHP运行带来不少速度提升。
我们将PHP5.3.24和Wincache安装包都下载好,这里我提供已经打包好的,这个包已经整合好Wincache,并且只要略为修改即可使用。下载地址:PHP5.3.24整合包下载
引用
此整合包特别说明,版本为PHP5.3.24NTS,并未做任何优化,遵循最小化修改原则,如果你的应用有特殊要求,可以在此基础上进行一些必要的修改即可
下载我给的整合包之后,解压出来,得到一个php5324的文件夹,找到里面php.ini文件,并用记事本或其他更专业的文字编辑器打开,需要修改如下几个地方
引用
1、找到下面这一行的内容
复制代码
- extension_dir = "D:websoftphp5324ext"
其中D:websoftphp5324是你的PHP存放路径,修改为你实际的路径即可,这里需要有一个特别要求,这个目录需要有IIS账号的可读权限,平时我都是简单的给一个everyone可读权限,其次还有一个我不成文的建议,一定不要把PHP安装在系统盘,原因就不细说了。
2、找到下面这一行代码复制代码
- upload_tmp_dir = D:websoftphp5324upload_tmp
其中D:websoftphp5324upload_tmp是PHP的上传临时存放路径,这个路径可以随意指定,但是必须要让IIS账号有可写权限,我一般直接给了everyone可写权限,另外就是建议这个路径不要放在系统盘,我比较喜欢直接放在PHP目录里面,这样会显得比较好看一点。
进行完如上两点修改后,我们的PHP就准备好了,接下来我们打开IIS8管理器,选中左边的服务器名,并在中间部分的功能区选择“处理程序映射”,在处理程序映射界面选择右边操作栏的"添加模块映射“,具体如下几个图所示


在添加模块映射的界面,我们需要填写如下几个项目
引用
请求路径 填 *.php
模块 选择 FastCgiModule
可执行文件选择你PHP安装目录下的php-cgi.exe,比如我示例中的 D:websoftphp5324php-cgi.exe
名称填写 PHP

添加好模块映射后,去IIS默认站点目录下添加一个php文件,填入如下内容,然后访问,看看是不是见到了如下令人惊喜的页面呢
复制代码
- phpinfo();
- ?>
至此,我们的PHP运行环境就搭建好了,非常的简单。如果还有任何问题,直接留言,我会一一解答的。
其实Win08上PHP的添加是一样的,只是08上还需要额外安装Microsoft Visual C 2008 Redistributable Package,下载地址:http://download.microsoft.com/download/A/5/3/A53B40CA-F75C-4678-852A-3C15EA82F186/vcredist_x86.exe

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

AI Hentai Generator
Generate AI Hentai for free.

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



Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

In PHP, the final keyword is used to prevent classes from being inherited and methods being overwritten. 1) When marking the class as final, the class cannot be inherited. 2) When marking the method as final, the method cannot be rewritten by the subclass. Using final keywords ensures the stability and security of your code.

The solution to MySQL installation error is: 1. Carefully check the system environment to ensure that the MySQL dependency library requirements are met. Different operating systems and version requirements are different; 2. Carefully read the error message and take corresponding measures according to prompts (such as missing library files or insufficient permissions), such as installing dependencies or using sudo commands; 3. If necessary, try to install the source code and carefully check the compilation log, but this requires a certain amount of Linux knowledge and experience. The key to ultimately solving the problem is to carefully check the system environment and error information, and refer to the official documents.

The future of PHP will be achieved by adapting to new technology trends and introducing innovative features: 1) Adapting to cloud computing, containerization and microservice architectures, supporting Docker and Kubernetes; 2) introducing JIT compilers and enumeration types to improve performance and data processing efficiency; 3) Continuously optimize performance and promote best practices.

The main reasons for MySQL installation failure are: 1. Permission issues, you need to run as an administrator or use the sudo command; 2. Dependencies are missing, and you need to install relevant development packages; 3. Port conflicts, you need to close the program that occupies port 3306 or modify the configuration file; 4. The installation package is corrupt, you need to download and verify the integrity; 5. The environment variable is incorrectly configured, and the environment variables must be correctly configured according to the operating system. Solve these problems and carefully check each step to successfully install MySQL.

Unable to access MySQL from the terminal may be due to: MySQL service not running; connection command error; insufficient permissions; firewall blocks connection; MySQL configuration file error.

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

The MySQL connection may be due to the following reasons: MySQL service is not started, the firewall intercepts the connection, the port number is incorrect, the user name or password is incorrect, the listening address in my.cnf is improperly configured, etc. The troubleshooting steps include: 1. Check whether the MySQL service is running; 2. Adjust the firewall settings to allow MySQL to listen to port 3306; 3. Confirm that the port number is consistent with the actual port number; 4. Check whether the user name and password are correct; 5. Make sure the bind-address settings in my.cnf are correct.
