整理:Apache+MySql+PHP的快速安装
虽然网上很多,还是在这里记录一下自己一安装过程,和一些经验,也不必以后安装再到处去找。
先说MySql,因为他可以说完全独立和Apache、php的安装没有直接联系。现在MySql5.0已经正式发布了,新增了许多新功能,数据库该有的功能基本已经具备了,如视图,子查询,存储过程等等。(MySql官方网站为http://www.mysql.com,我想这个应该大家不应该不知道吧^-^,找到download下载一个安装程序。),点开安装程序,按着他一步的选择,设好参数。顺利装好就可以了,新版本安装程序就很大的改进了,已经连服务都已经注册好了,以前的版本只是帮你复制一下程序文件而已,这里顺便说下以前装服务的方法:在运行中输入c:\mysql\bin\mysqld-nt.exe --install.( c:\mysql\j是MySql安装所在路径。)没有问题就装好了,命令行输入:net start mysql启动服务就可以了。
如果以前是Mysql4.1以下版本,装好以后所有程序无法连接mysql原因如下:
mysql4.1以上版本连接时出现Client does not support authentication protocol问题解决办法
shell> mysql
Client does not support authenticationprotocol requested
by server; consider upgrading MySQL client
官方的说法:MySQL 4.1 and up uses an authenticationprotocol based on a password hashing algorithm that is incompatible with thatused by older clients. .....
如果你升级mysql到4.1以上版本后遇到以上问题,请先确定你的mysqlclient 是4.1或者更高版本.(WINDOWS下有问题你就直接跳到下面看解决方法了,因为MYSQL 在WINDOWS是client和server一起装上了的)
请使用以下两种方法之一
其一:
mysql> SET PASSWORD FOR
-> ''some_user''@''some_host'' =OLD_PASSWORD(''newpwd'');
其二:
mysql> UPDATE mysql.user SET Password =OLD_PASSWORD(''newpwd'')
-> WHERE Host = ''some_host'' AND User =''some_user'';
mysql> FLUSH PRIVILEGES;
上面红色的部分请按自己实际情况修改....
这样做后,连接就会正常了!
现在的版有很明确的配置文件,以前好像位置不是很确定也很少人用,现在很好了在mysql根目录下的my.ini选项也很丰富了。相关的就自己看吧,说明一个datadir="E:/document/data"这个是数据目录,这样就可以移到其它地方了。
Mysql到此结束。
现在开始安装Apache,打开安装程序,设定自己的参数,端口默认为80,如果该端口已用改成其它的如8080。安装完成。apache就可以用了,做还要做一些其它的设置,可以打开IE输入http://localhost:80试一下如果页面正常说明安装成功。
现在安装php,装文件解压到C:\php或你自己想要的目录,首先,请将C:\Php\Dlls目录中的所有DLL文件(PHP5没有这个目录就拷要目录下的所有DLL,当然有点是不要的知道的话就去掉。)拷贝到Windows的System目录(%windir%\System),这里特别注意的就是%windir%\System这里指的是系统变量,一般win 98是c:\windows/system ,2000/xp/2003是c:\windows(winnt)\system32。但也有特殊情况,我用的是XP有一次安装但复制到system32就是不行要在system就可以了,目前不知道原因,给大家提个醒。将C:\Php\Php.ini-recommended、php4ts.dll(php5ts.dll)拷贝到Windows目录(%windir%),把它重命名为php.ini,并用文本编辑器打开它。编辑其中对extension_dir和session.save_path进行设置的3行,使其和下面展示的一致,注意要把InstallDir替换成你的Apache 的安装目录的名称。
extension_dir = c:\php\extensions (PHP扩展动态链接文件)
session.save_path = c:/temp(自己填写一个目录)
其它的就跟据自己的需要设置了。
添加php相关设置
找到DirectoryIndexindex.html index.html.var 加上index.php,可以加入你自己想要的索引页,如login.php,default.php。
找到
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
加入
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source.phps (.phps是显示代码的文件)
AddType image/x-icon .ico
找到
#LoadModule usertrack_modulemodules/mod_usertrack.so
#LoadModule vhost_alias_modulemodules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so
加入
LoadModule php4_moduleC:\php\sapi\php4apache2.dll
(PHP5:LoadModule php5_module C:\php\php5apache2.dll)
如果你出于某种原因而需要在CGI模式中运行php程序(使用php.exe),请将上面这一行变成注释,并在Httpd.conf中添加下面这些行:
scrīptAlias /php/ "c:/php/"
Action application/x-httpd-php"/php/php.exe"
这样就可以支持php了,以下介绍一些相关的设置
Listen 80
这个是端口 设置
DocumentRoot "E:/database/php"
这个是文档的目录
AddDefaultCharset ISO-2022-CN(gb2312)
这里设置默认编码,这里是设成中文的,如果你发现你的网页都是乱码就要设置这一项了
这里就完成了所有的安装工作,可以试试了,不要忘了把Apache重启一下。

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 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.

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.

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

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

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

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)
