Apache+php+mysql在windows下的安装与配置图解
欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入 二、php的安装、以module方式,将php与apache结合使你的网站服务器支持php服务器脚本程序 将下载的php安装文件 php-5.0.5-Win32.zip 右键解压缩。 指定解压缩的位置,我的设定在“D:\php” 查看解
欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入
二、php的安装、以module方式,将php与apache结合使你的网站服务器支持php服务器脚本程序
将下载的php安装文件php-5.0.5-Win32.zip右键解压缩。

指定解压缩的位置,我的设定在“D:\php”

查看解压缩后的文件夹内容,找到“php.ini-dist”文件,将其重命名为“php.ini”,打开编辑,找到下面图中的地方, Ln385,有一个“register_globals = Off”值,这个值是用来打开全局变量的,比如表单送过来的值,如果这个值设为“Off”,就只能用“$_POST['变量名']、$_GET['变量名 ']”等来取得送过来的值,如果设为“On”,就可以直接使用“$变量名”来获取送过来的值,当然,设为“Off”就比较安全,不会让人轻易将网页间传送的数据截取。这个值是否改成“On”就看自己感觉了,是安全重要还是方便重要?

这里还有一个地方要编辑,功能就是使php能够直接调用其它模块,比如访问mysql,如下图所示,Ln563,选择要加载的模块,去掉前面的 “;”,就表示要加载此模块了,加载的越多,占用的资源也就多一点,不过也多不到哪去,比如我要用mysql,就要把“;extension= php_mysql.dll”前的“;”去掉。所有的模块文件都放在php解压缩目录的“ext”之下,我这里的截图是把所有能加载的模块都加载上去了,前面的“;”没去掉的,是因为“ext”目录下默认没有此模块,加载会提示找不到文件而出错。这里只是参考,一般不需要加载这么多,需要的加载上就可以了,编辑好后保存,关闭。


现在开始将php以module方式与Apache相结合,使php融入Apache,照先前的方法打开Apache的配置文件,Ln 173,找到这里,添加进如图所示选中的两行,第一行“LoadModule php5_module D:/php/php5apache2.dll”是指以module方式加载php,第二行“PHPIniDir "D:/php"”是指明php的配置文件php.ini的位置,是当然,其中的“D:/php”要改成你先前选择的php解压缩的目录。

还是Apache的配置文件,Ln 757,加入“AddType application/x-httpd-php .php”、“AddType application/x-httpd-php .html”两行,你也可以加入更多,实质就是添加可以执行php的文件类型,比如你再加上一行“AddType application/x-httpd-php .htm”,则.htm文件也可以执行php程序了,你甚至还可以添加上一行“AddType application/x-httpd-php .txt”,让普通的文本文件格式也能运行php程序。

前面所说的目录默认索引文件也可以改一下,因为现在加了php,有些文件就直接存为.php了,我们也可以把“index.php”设为默认索引文件,优先顺序就自己排了,我的是放在第一位。编辑完成,保存,关闭。

现在,php的安装,与Apache的结合已经全部完成,用屏幕右下角的小图标重启Apache,你的Apache服务器就支持了php。
[1] [2] [3]

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











VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

The open source VNC tool Tigervnc is compatible with a wide range of operating systems, including Windows, Linux, and macOS. This article will introduce in detail the application of Tigervnc on the Debian system. Tigervnc is integrated in the application system of Debian system: In the Debian system, Tigervnc is integrated into the system as a VNC server component. Users can start VNC services through command line tools such as vncserver and customize display settings such as resolution and color depth. Cross-platform connection: Tigervnc client supports Windows, Linux, and macOS, which means users can run this from any

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

Mac system maintenance includes: disk management (use OmniDiskSweeper to clean disk space, use disk tools to check disk errors) memory management (use Activity Monitor to monitor memory usage, end over-occupying processes) startup item management (use Linc or LaunchControl to manage startup items, disable unnecessary startup items) system cache cleaning (use CleanMyMac X or manually clean system cache) software update (timely update system and applications) regular backup (use Time Machine to backup data regularly) good usage habits (not installing applications excessively, cleaning files regularly, and monitoring system logs)

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.
