PHP入门:在Windows中安装PHP工作环境
PHP入门:在Windows系统中分别安装PHP工作环境 一、什么是LAMP? Linux+Apache+Mysql+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应
PHP入门:在Windows系统中分别安装PHP工作环境
一、什么是LAMP?
Linux+Apache+Mysql+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。随着开源潮流的蓬勃发展,开放源代码的LAMP已经与J2EE和.Net商业软件形成三足鼎立之势,并且该软件开发的项目在软件方面的投资成本较低,因此受到整个IT界的关注。从网站的流量上来说,70%以上的访问流量是LAMP来提供的,LAMP是最强大的网站解决方案。
二、安装Apache服务器
web服务器有很多种,主流的有Apache服务器、Lighttpd服务器、Tomcat服务器、IBM WebSphere服务器、Microsoft IIS等,我们今天要安装的就是世界上用得最多的Web服务器,其市场占有率达60%左右的Apache服务器。
2.1、下载地址:http://httpd.apache.org/
2.2、安装方式:http://jingyan.baidu.com/article/0964eca227a0fb8285f536a3.html
三、安装MySql数据库
安装MySql的方法主要有两种,一种是解压版的,另一种是安装版的。两者的区别是解压版的需要手动配置一些参数。如果你云官网下载需要注册Oracle的账户,建议直接百度下载一个就行了。
3.1、解压版MySql安装方法:http://michael-wong.iteye.com/blog/976381
3.2、安装版MySql安装方法:http://wenku.baidu.com/link?url=e56Y84enINF6OjWyUMq1Oq4I_0INv6LZQVEmip1XLukPLKX4qnJHHwRkU8kVR6vd1zZfgjQTwLF3moUQI6M2WusQPGvZQYHzB7BK8ucYzWm
四、安装PHP
这里选择下载php-5.2.6-Win32.zip版,之所以不下载最新版5.5.7,是因为对于这个版本的安装方式网络上没有资料,与前几个版本的安装方式有些区别?所以还是选这个版本,当然你也可以尝试安装最新版,不过对于刚初学的人来说,有必要一味追求新版吗?
4.1、下载地址:http://pan.baidu.com/share/link?shareid=822524062&uk=2318720427
4.2、具体安装:
4.2.1、把下载的文件解压放到某一个目录,比如C:\lamp\php5.2.5\下面
4.2.2、把php以模块的方式加载到apache服务器上:
4.2.2.1、在Apache安装目录的conf下找到httpd.conf文件并打开它,比如我的是C:\lamp\apache\conf\httpd.conf;
4.2.2.2、在打开的文件中找到
4.2.3、那还要干什么呢?那就是告诉服务器php文件的后缀名是什么,只有这样apache服务器才知道要去解析.php为后缀的文件。
4.2.3.1、还是在httpd.conf文件里面,找到AddType application/x-gzip .gz .tgz这行代码,这里提醒的是如果你找到的这行代码有一个#号,那表示这行被注释掉了,你得没有被注释掉的这行代码,然后在它的下面插入:AddType application/x-httpd-php .php .phtml
4.2.4、接下来还要指定php配置文件的位置,怎么指定呢?还是在刚才插入代码的下面加上一行:PHPIniDir "c:/lamp/php5.2.5",大小写其实是无所谓的,切记路径要改成你自己的,当然如果路径和我的一样就不用管了。
4.2.5、是不是感觉要配置的东西很多,不要着急马上就结束了,待会你就能够看到测试页面了。我下载的这个版本是没有php.ini这个文件的,新版本有没有,不得而知,那怎么办呢?简单,我们去php的安装文件找到php-ini-recommerded文件,把这个文件给重命名成php-ini文件就可以了。我这边的地址是:C:\lamp\php5.2.5\php-ini-recommerded。
http://www.cnblogs.com/roucheng/
4.3、测试一下安装是否成功
现在我们在apache服务器安装目录的htdocs中写一个文本文件(C:\lamp\apache\htdocs\test.txt),在这个文本文件里写上几句代码:
phpinfo();
就写两句代码吗?是的你照着写就行了,保存这个文件之后再把其后缀名改成.php即可。
4.4、启动apache服务器开始测试程序
4.4.1、启动方式有两种,一是使用它自带的工具启动,另一种是直接在cmd的命令窗口里输入net start apache2.2回车。
4.4.2、打开浏览器输入网址:http://localhost/回车就可以看见一句话It works!,那表示你服务正常启动了。接着在地址里输入http://localhost/test.php回车,你会发现出一个非常漂亮的php配置信息页面,那证明你成功了,骚年!
4.4.3、你以为事件到这里就结束了吗?现在我们只是把Apache服务器和php连接到一起了,但是php还是不能访问MySql数据库呀?默认是没有的,我们必须手动去开启。
4.4.3.1、到php安装目录(我的是C:\lamp\php5.2.5\libmysql.dll)找到libmysql.dll这个文件并把它复制到C:\Windows这个目录下。需要说明的是你如果设置环境变量也可以,方法是你在环境变量里找到path,然后在最后面加入php安装目录的路径上去就可以了。
4.4.3.2、那现在php就可以找到mysql了,但我们想要扩展mysql的连接库,方法是在php安装目录下找到php.ini文件并打开它,在文件里找到;extension=php_bz2.dll这行代码,并在它的上面插入一行写上:extension_dir="c:/lamp/php5.2.5/ext",这是个什么意思了,表示我机器上安装的扩展库的位置是这里。具体位置根据你电脑上实际情况处理。
4.4.3.3、还是在这个php.ini文件里面找到两行代码extension=php_mysql.dll,extension=php_mysqli.dll,把这两行前面的;号去掉,这就表示打开或开启了这个功能。那怎么才知道是否正确的配置成功了呢?很简单现在马上重启服务器,然后再访问一次http://localhost/test.php,这时你在页面会发现如下图所示的信息
五、安装php优化软件
是不是感觉配置太多了,没关系,这步你不做也可以,只是安装了这个东西之后,可以让你的php项目性能提升40%,你自己考虑吧!
5.1、软件名称:ZendOptimizer-3.3.3-Windows-i386.zip
5.2、下载地址:http://pan.baidu.com/share/link?shareid=3641277684&uk=1277919049&fid=1806952306
5.3、安装方法:这个版本是下一步下一步安装的,所以就不演示了,如果还不知道就百度吧!打了太久字累了。
说明:PHP5.3开始ZendOptimizer正式改为Zend Guard Loader,(官方地址:http://www.zend.com/en/products/guard/downloads)
(完)

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

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

The way to update ByBit exchanges varies by platform and device: Mobile: Check for updates and install in the app store. Desktop Client: Check for updates in the Help menu and install automatically. Web page: You need to manually access the official website for updates. Failure to update the exchange can lead to security vulnerabilities, functional limitations, compatibility issues and reduced transaction execution efficiency.

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total
