Home >Backend Development >PHP Tutorial >Installation and configuration of Apache+php+mysql under windows (picture and text) Page 1/2_PHP Tutorial
Prepare the software first:
1. Install Apache and successfully configure an ordinary website server
Run the downloaded "apache_2.0.55-win32-x86-no_ssl.msi ”, the following interface appears:
The installation wizard interface of Apache HTTP Server 2.0.55 appears, click "Next" to continue
Confirm that you agree to the software installation and use license terms, select "I accept the terms in the license agreement", and click "Next" to continue
Instructions for installing Apache on Windows, please read it and press " Next" continue
Settings System information, fill in your domain name under Network Domain (for example: goodwaiter.com), fill in your server name under Server Name (for example: www.goodwaiter.com, which is the host name plus domain name), fill in the system administrator's contact email address under Administrator's Email Address (for example: yinpeng@xinhuanet.com). The above three information are for reference only, and the contact email address will be Provided to visitors in case of system failure. All three pieces of information can be filled in arbitrarily, including invalid ones. There are two options below. The one selected in the picture is to install it for all users of the system, using the default port 80, and automatically start it as a system service; the other one is to install it only for the current user, use port 8080, and start it manually. The general selection is as shown in the figure. Press "Next" to continue. ]
Select installation type , Typical is the default installation, Custom is the user-defined installation, we choose Custom here, there are more options.Press "Next" to continue
The interface for selecting installation options appears, as shown in the figure. Left-click "Apache HTTP Server 2.0.55" and select "This feature, and all subfeatures, will be installed on local hard drive.", that is, "This section, and All subordinate sub-parts are installed on the local hard disk."Click "Change..." to manually specify the installation directory.
I choose to install it here In "D:", you select it yourself. It is generally recommended not to install it on the disk where the operating system is located, so as to avoid the restoration operation clearing the Apache configuration file if the operating system is damaged. Select "OK" to continue.
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open(this.src);}" alt="" src=" http://www.bkjia.com/uploads/allimg/131016/0642332441-7.gif" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen. width*0.7; this.alt='Click here to open new window nCTRL+Mouse wheel to zoom in/out';}" border=0>
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt=' Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open(this.src);}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/064233NO-8.gif" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width =screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0>
screen.width*0.7. ) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';} " onclick="if(!this.resized) {return true;} else {window.open(this.src);}" alt="" src="http://www.bkjia.com/uploads/allimg/ 131016/0642331A6-9.gif" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0>
The installation wizard completed successfully , then the green icon below should appear in the status bar in the lower right corner, indicating that the Apache service has started running. Press "Finish" to end the Apache software installation
Let’s get familiar with this icon. It’s very convenient. Left-click on the icon and the following interface will appear. , there are three options: "Start", "Stop", and "Restart", which can easily perform the above operations on the installed Apache server.
Okay now we Let's test the website interface running according to the default configuration , and type "http://127.0.0.1" in the IE address bar. Click "Go" and you will see the following page, indicating that the Apache server has been installed successfully.
Now let’s configure the Apache server so that it can serve us better. In fact, if we don’tconfiguration, the Apache2htdocs folder in your installation directory is the default root directory of the website, just put the file in it. Here we still need to configure if there are any problems or modifications, configure It is always necessary to know, as shown in the figure, "Start", "All Programs", "Apache HTTP Server 2.0.55", "Configure Apache Server", "Edit the Apache httpd conf Configuration file", click to open.
XP Notepad has some minor changes. A very practical function is that you can see the row and column positions of the file content. As shown in the figure below, click "View" and check "Status bar", there is an additional mark in the lower right corner of the interface, "Ln 78, Col 10" means "line 78, column 10", which can quickly locate in the file and facilitate explanation. Of course, you can also use " Edit", "Search" and enter keywords to quickly locate. Every change in the configuration file must be saved and must take effect after the Apache server is restarted. You can use the small icon mentioned earlier to conveniently control the server to "restart" at any time
Now officially start configuring the Apache server, "Ln 228", or search for the keyword "DocumentRoot" (that is, the root directory of the website), find the place as shown in the picture below, and then " Change the address in " to the root directory of your website. Please write the address format as shown in the picture. The main reason is that the "" in the general file address must be changed to "/" in Apache.
“Ln 253”,同样,你也可以通过查找“
“Ln321”,DirectoryIndex(目录索引,也就是在仅指定目录的情况下,默认显示的文件名),可以添加很多,系统会根据从左至右的顺序来优先显示,以单个半角空格隔开,比如有些网站的首页是index.htm,就在光标那里加上“index.htm ”文件名是任意的,不一定非得“index.html”,比如“test.php”等,都可以。
这里有一个选择配置选项,以前可能要配置,现在好像修正过来了,不用配置了,就是强制所有输出文件的语言编码,html文件里有语言标记(,这个就是设定文档语言为gb2312)的也会强制转换。如果打开的网页出现乱码,请先检查网页内有没有上述 html语言标记,如果没有,添加上去就能正常显示了。把“# DefaultLanguage nl”前面的“# ”去掉,把“nl”改成你要强制输出的语言,中文是“zh-cn”,保存,关闭。
好了,简单的Apache配置就到此结束了,现在利用先前的小图标重启动,所有的配置就生效了,你的网站就成了一个网站服务器,如果你加载了防火墙,请打开80或8080端口,或者允许Apache程序访问网络,否则别人不能访问。如果你有公网IP(一般ADSL或电话拨号上网的都是),就可以邀请所有能上网的朋友访问使用http://你的IP地址(IP地址查询可访问http://www.goodwaiter.com,查询内容内即是)你的网站了;如果你没有公网IP,也可以把内网IP地址告诉局域网内的其它用户,让他们通过http://你的内网IP地址,访问你的网站。
二、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”就看自己感觉了,是安全重要还是方便重要?