简单介绍win7下搭建apache+php+mysql开发环境,win7apache
简单介绍win7下搭建apache+php+mysql开发环境,win7apache
环境目录:E:\dev
一、Apache
下载地址:http://www.apachelounge.com/download/
我们下载VC11运行库的
1.安装说明:
运行apache安装程序,方法非常简单,弹安装界面后一直“next”
接着会出现一个界面,需要填写3个内容,分别为:Network Domain、Server Name、Administrator's Email Address 随便填写就好,不影响内容。
在下面还有2个选项,默认选择为80端口,第二个为8080端口,根据个人需求选择,一般为默认80端口。
我们继续安装,选择Custom(自定义安装)-“next”
其中有打着红X的组件,我们单击这个组件容,选择“This feature, and all subfeatures, will be installed on local hard drive.”,即“此部分,及下属子部分内容,全部安装在本地硬盘上”。-“next”
然后选择右下角的“change ”改变安装路径,安装到刚才建立的目录中“D:\WAMP\Apache\”-“next”
安装完毕后,电脑右下角会多出一个图标,双击打开,选择start或restart,能正常运行,至此安装完毕。
2.修改配置:
打开安装录下D:\WAMP\Apache\conf\httpd.conf 文件(修改配置文件时,不建议使用记事本,可能会对其造成影响,推荐使用Notepad++或其他编辑软件打开修改)
打开以后Ctrl+F查找所要修改的内容
在#LoadModule vhost_alias_module modules/mod_vhost_alias.so下添加:
LoadModule php5_module “D:/WAMP/PHP/php5apache2_2.dll” PHPIniDir “D:/WAMP/PHP” AddType application/x-httpd-php .php AddType application/x-httpd-php .htm AddType application/x-httpd-php .html DocumentRoot “E:/WAMP/Apache/htdocs”
修改成(这里的路径和IIS中wwwroot目录一样,用于存放网页,自定义或不做修改默认):DocumentRoot “D:/WAMP/www”
修改成(自定义或不做修改默认):
DirectoryIndex index.html
修改成:DirectoryIndex index.php default.php index.html index.htm default.html default.htm
二、PHP
下载地址:http://windows.php.net/download
目前最新版本是PHP 5.6.11
1、架构 X86 和 X64
2、安全模式 Thread Safe(线程安全) Non Thread Safe(非线程安全)
apache选择Thread Safe,IIS选择Non Thread Safe
3、运行库, VC11
我是Win7 64位的,所以选择VC11 x64 Thread Safe (2015-Jul-10 06:25:47)
1.安装说明
由于我们下载的的是ZIP压缩包,只需要将文件解压到“D:\WAMP\PHP”目录下即可
2.修改配置
将D:\WAMP\PHP\php.ini-development 文件修改成php.ini
打开php.ini
; extension_dir = “ext”
修改成:extension_dir = “E:\WAMP\PHP\ext”
将947行下,这些文件前面的“;”去除
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
extension=php_xmlrpc.dll
;date.timezone =
修改成(很多网站没提到这里要修改,默认为美国时间,如果不修改会报错):date.timezone = Asia/Shanghai
三、MySQL
安装方式:
1、.msi MSI Installer http://dev.mysql.com/downloads/installer/
2、解压安装 http://dev.mysql.com/downloads/mysql/
1.安装说明:
打开安装程序,单击“next”
选择custom,组件为默认选择,我们不做改动-“next”
路径设置为“D:\WAMP\Mysql”-“next”
安装好以后点击“finish”
跟着会出现一个配置向导-“next”
选择“Detailed Configuration(详细配置)”-“next”
这里有3个选项:
Developer Machine,将只用尽量少的内存;
Server Machine,将使用中等数量内存;
Dedicated MySQL Server Machine,这台服务器上面只跑mysql数据库,将占用全部的内存。
可以根据自己需求选择,这里我们选择第二种“Server Machine”-“next”
选择数据库用途,同样有3个选项:
Mutltifunctional Database多功能用途,将把数据库优化成很好的innodb存储类型和高效率的myisam存储类型;
Transactional Database Only只用于事务处理类型,最好的优化innodb,但同时也支持myisam;
Non-Transactional Databse Only非事务处理类型,适合于简单的应用,只有不支持事务的myisam类型是被支持的。
一般选择第一种多功能的,同样我们也是。-“next”
选择InnodDB的数据存放位置,一般默认就行,为了统一我填写了“WAMP/MySQL Datafiles”-“next”
选择mysql允许的最大连接数,第一种是最大20个连接并发数,第二种是最大500个并发连接数,最后一种是自定义,自己可以根据需求选择,我选择第二个-“next”
下面是选择数据库监听的端口,一般默认是3306,如果改成其他端口,以后连接数据库的时候都要记住修改的端口,否则不能连接mysql数据库,比较麻烦,这里不做修改,用mysq的默认端口:3306-“next”
这一步设置mysql的默认编码,我们选择第三个,并在Character Set菜单中,选择“gbk”编码-“next”
(注:如果要用原来数据库的数据,最好能确定原来数据库用的是什么编码,如果这里设置的编码和原来数据库数据的编码不一致,在使用的时候可能会出现乱码。)
这一步是是否要把mysql设置成windows的,一般选择设成服务,这样以后就可以通过服务中启动和关闭mysql数据库。下面的复选框也勾选上,这样,在cmd模式下,不必非到mysql的bin目录下执行命令。也就是把上下2个勾都打上,中间默认-“next”
这一步是设置mysql的超级用户密码,这个超级用户非常重要,对mysql拥有全部的权限,请设置好并牢记超级用户的密码,下面有个复选框是选择是否允许远程机器用root用户连接到你的mysql服务器上面,如果有这个需求,也请勾选。这里我们使用默认选择,在New root password和Confirm中输入密码。“next”
点击“execute”进行配置,稍微等待一会,圆点上的勾全部打上,就代表配置完毕。
2.修改配置:
打开D:\WAMP\MySQL\my.ini
设置datadir为D:/WAMP/MySQL/data/或你所要存放数据位置的目录即可。
四、Memcached
下载地址:http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available
目录:dev/memcached
安装:在命令行执行 E:\dev\memcached\memcached.exe -d install
启动:E:\dev\memcached\memcached.exe -d start
php memcache扩展下载: http://pecl.php.net/package/memcache
php.ini开启扩展 extension=php_memcache.dll
五、Redis 和 PHP redis扩展
redis下载地址:https://github.com/MSOpenTech/redis/releases
php redis扩展下载地址:http://pecl.php.net/package/redis
把下载的php_redis.dll放到php的扩展目录ext,然后,在php.ini中开启即可
六、结尾
至此Windows7下的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



To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

This article will explain how to improve website performance by analyzing Apache logs under the Debian system. 1. Log Analysis Basics Apache log records the detailed information of all HTTP requests, including IP address, timestamp, request URL, HTTP method and response code. In Debian systems, these logs are usually located in the /var/log/apache2/access.log and /var/log/apache2/error.log directories. Understanding the log structure is the first step in effective analysis. 2. Log analysis tool You can use a variety of tools to analyze Apache logs: Command line tools: grep, awk, sed and other command line tools.

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

This article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://<server IP or domain name>/server-status), or view the Apache configuration file (ServerVersion: Apache/<version number>).
