Windows上配置PHP环境
Windows下配置PHP环境
phpnow在Windows下配置环境很是方便,但是兼容并不是很好,有些时候我们还需要手动在Windows配置PHP环境,手动配置又很麻烦经常忘记配置步骤。所以今天特意记录配置过程。
首先我们需要下载:
apache的官方下载地址:
http://httpd.apache.org/download.cgi
mysql官方下载地:
http://dev.mysql.com/downloads/mysql/5.0.html#win32
php官方下载地址:http://www.php.net/downloads.php
phpMyAdmin官方下载地址:http://phpmyadmin.com/
?
所需软件我们是下载完了,接下来我要安装,点击apache_2.0.59-win32-x86-no_ssl.msi,apache默认端口我们选择80,还有就是不要和IIS得端口号有冲突。与普通应用程序安装
和类似。程序安装完后,我们在浏览器中输入:http://127.0.0.1就可以看到标题写着安装Apache测试页面,表示我们得apache安装成功。
?
Mysql安装:
我们运行mysql文件夹下的Setup.exe。其中有需要设置密码一步,一般建议密码不要为空(如:我们把密码设置成123456)。接着点击下一步,接着是Finish。我们的数据库也安装完毕了。
?
PHP安装配置:
我们把php-5.2.3-Win32.zip解压到C盘根目录下,把文件夹名字改成PHP,这样方便一下。找到PHP目录下的“php.ini-dist”或者“php.ini-recommended”文件,我们把它从命名为"php.ini",复制到“C:\WINDOWS”下。
在将php目录下得php5ts.dll复制到“C:\WINDOWS\system32”目录下。
将php\ext目录下的“php_gd2.dll”与“php_msql.dll”复制到“C:\WINDOWS\system32”目录下。
修改apache的httpd.conf:找到E:\Apache2\conf下得“httpd.conf”文件(最好事先备份一下)。
找到DocumentRoot,把它修改成你网站得根目录,如“DocumentRoot "E:/Apache2/htdocs"”;
查找DirectoryIndex index.html index.html.var 在后面加入index.php
查找#LoadModule ssl_module modules/mod_ssl.so 令起一行加入LoadModule php5_module c:\php\php5apache2.dll;
查找AddType application/x-gzip.gz.tgz后面加入一行AddType application/x-httpd-php.php;
写一个文件index.php,加入""放到apache的根目录下,从起apache服务器,在浏览器中输入:http://126.0.0.1/index.php, 看到php的配置信息,php版本,表示php配置成功.
?
mysql配置:
打开c:\windows\php.ini文件;
查找;extension=php_mysql.dll,去掉';'注释;
查找;extension=php_gd2.dll,去掉';'注释;
查找;extension=php_mbstring.dll,去掉';'注释;
查找;session.save_path="/temp",去掉";",把"/temp"修改成"C:\WINDOWS\Temp";
查找;extension_dir修改为extension_dir="c:\php\ext";
将 libmysql.dll复制到"c:\windows\system32"目录下
查找;extension=php_mysql.dll,去掉';'注释;
重启apache服务器即可.
?
安装配置phpMyAdmin:
把phpMyAdmin解压到apache根目录下(E:\apache\hotdocs),修改E"\apache\htdocs\phpMyAdmin\config.inc.php文件,设置用户名,密码(我们在安装mysql的时候设置过的用户名和密码).在浏览器中输入http://127.0.0.1/phpMyAdmin/ ,即可很方便的管理我们的数据库了.
?
配置apache的虚拟目录:
打开C:\WINDOWS\system32\drivers\etc\hosts文件,添加127.0.0.1 ceshi.com
打开E:\apache\htdocs\httpd.conf文件
找到#NameVirtualHost *:80,去掉"#";
?
ServerAdmin nide@gmail.com //你的邮箱
DocumentRoot E:/www/web //你的虚拟路径地址
ServerName ceshi.com //虚拟路径网址
ErrorLog logs/dummy-host.ceshi.com-error_log
CustomLog logs/dummy-host.ceshi.com-access_log common
?
如果需要设置多个虚拟路径只需要复制

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



PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip
