最新消息:XAMPP默认安装之后是很不安全的,我们只需要点击左方菜单的 "安全"选项,按照向导操作即可完成安全设置。

安装运行

admin 29403浏览 0评论

安装、启动

以系统管理员用户登录,将下载的包在服务器上解压到任意目录(不能放在中文名目录内)、比如放到c盘根目录,
双击运行目录内的setup_xampp.bat初始化xampp。然后运行 xampp-control.exe 可以启动或停止apache、mysql等各个模块并可将其注册为服务。

PHP 5与PHP 4的切换
XAMPP从 1.4.7版开始支持PHP 5与PHP 4可选启动,便于用户根据PHP程序的需要做出选择。
运行根目录下的php-switch.bat即可进入php切换的命令窗口
切换到php4:
在命令窗口输入4
切换到php5:
在命令窗口输入5
移动整体环境到其它地方(移动到其它目录或服务器)
只运行根目录下的setup_xampp.bat即可进入命令窗口,选择“1″对环境重新进行初始化即可。
注意:如果您启用了虚拟主机,这时需要重新检查虚拟主机配置文件中的相对路径是否正确(如果设置的是绝对路径则不必检查)

系统安全

XAMPP默认安装之后是很不安全的,普通用户不用任何密码就可以访问其Web管理页面,修改数据库。我们只需要点击左方菜单的 “安全”选项,按照向导操作即可完成安全设置。
在默认状态下,phpmyadmin有两个用户名,分别是pma和root。其中,root是管理员身份,而pma则是普通用户身份,但二者在缺省状态下均无密码。
这里的两个默认用户的密码务必要设置,设置方法:
(1)先在“安全”这里设置好root账户的密码
(2)通过默认主页左侧的phpmyadmin导航栏进入phpmyadmin界面,输入用户名root后直接点击登陆即可。
(3)更改pma帐号密码:登录后,点击首页的“权限”菜单,点击出现的“用户一览”页面的用户名“pma”后面的图标进入权限设置页面,在“编辑权限”这个页面的“更改密码”这里设置密码。更改后用写字板或记事本等文本编辑器xampp\phpMyAdmin\config.inc.php的第63行的pma密码更改为刚才设置的密码,否则,登陆会出错。
注:只有pma不设置密码时,XAMPP的web主界面的MySQL database的状态才会显示为ACTIVATED状态!

目录说明

Web程序(PHP、Html)都放到 xampp\htdocs\
perl文件目录xampp\cgi-bin\;
apache基础配置:xampp\apache\conf\httpd.conf
apache更多配置(如虚拟主机等)文件:xampp\apache\conf\extra\
php配置文件:xampp\apache\bin\php.ini

参数说明

xampp高级的启动与停止参数如下表信息。

参数
描述
start
启动 XAMPP。
stop
停止 XAMPP。
restart
重新启动 XAMPP。
reload
Apache,MySQL 和 ProFTPD(如果正在运行)重新载入各自的配置文件
startapache
只启动 Apache。
startssl
启动 Apache 的 SSL 支持。该命令将持续激活 SSL 支持,例如:执行该命令后,如果您关闭并重新启动 XAMPP,SSL 仍将处于激活状态。
startmysql
只启动 MySQL 数据库。
startftp
启动 ProFTPD 服务器。通过 FTP,您可以上传文件到您的网络服务器中(用户名“nobody”,密码“xampp”)。该命令将持续激活 ProFTPD,例如:执行该命令后,如果您关闭并重新启动 XAMPP,FTP 仍将处于激活状态。
stopapache
停止 Apache。
stopssl
停止 Apache 的 SSL 支持。该命令将持续停止 SSL 支持,例如:执行该命令后,如果您关闭并重新启动 XAMPP,SSL 仍将处于停止状态。
stopmysql
停止 MySQL 数据库。
stopftp
停止 ProFTPD 服务器。该命令将持续停止 ProFTPD,例如:执行该命令后,如果您关闭并重新启动 XAMPP,FTP 仍将处于停止状态。
reloadapache
Apache 服务器重新载入其配置文件。
reloadmysql
MySQL 数据库重新载入其配置文件。
reloadftp
ProFTPD 服务器重新载入其配置文件。

配置

只需要修改虚拟主机配置文件:xampp\apache\conf\extra\httpd-vhosts.conf。
这里只说明基于域名(服务器只有单ip)的虚拟主机配置方法,基于ip(服务器多ip,可以每个虚拟主机一个ip)等的配置方法请参考apache官方手册。
(1)请将“#NameVirtualHost *:80”这里的“#”去掉,即改为“NameVirtualHost *:80”,如果使用的非80端口,将这里和下面虚拟主机配置文件中的“80″改为实际端口即可。
(2)我们看看这个配置文件下面的“VirtualHost example:”这部分,为了便于本机操作,我们先建立起“localhost”这个虚拟主机,否则一旦启用虚拟主机会导致本地的xampp无法进入web管理界面。

配置文件自带了两个配置好但没启用的例子,我们建好的“localhost”的虚拟主机应该是这样的:

## ServerAdmin
DocumentRoot /xampp/htdocs
ServerName localhost
## ErrorLog @rel_logfiledir@/dummy-host2.error_log
## CustomLog @rel_logfiledir@/dummy-host2.access_log common

其中,没有注释符的几项是必需的,有注释符的项目是可选的,当然,您也可以根据apache官方文档设定更多的项目。
“DocumentRoot”:
必需。这个是虚拟主机站点的根目录,可以是相对路径或绝对路径、路径不能包含空格等特殊字符。使用相对路径时路径是相对环境所在的分区,我的环境放在d盘的根目录,所以示例中写作“/xampp/htdocs”、也可以写作“D:/xampp/htdocs”(后面不加”/”),如果环境放在d盘的www目录,那么这里的路径就要写作“/www/xampp/htdocs”、也可以写作“D:/www/xampp/htdocs”(后面不加”/”)。
配置虚拟主机失败多数都是路径设置的不对。
“ServerName”:
必需。这个是配置虚拟主机的域名。可以是“localhost”、“cmsware”、等。
虚拟主机配置常见问题:
如果配置后apache通过管理面板启动不了,请直接运行环境根目录下的apache_start.bat、apache_stop.bat启动或关闭apache,这时能看到具体的报错信息。
如果虚拟主机配置后没生效,看看apache报错日志(xampp\apache\logs\error.log)一般就能知道原因所在。

提醒

1,Skype与XAMPP的Apache有冲突,因为 Skype 缺省情况下把80端口和443端口作为接入设备的备用端口,也就是所谓的防火墙穿透了。
解决方法:重新设置 Skype 菜单 “工具”->”选项”->”连接” 项,去掉 “把80端口和443端口作为接入设备的备用端口” 前面的复选框。副作用:如果你的 Skype 处于防火墙/代理之下,将没法正常使用 Skype ,只有正确设置了防火墙/代理的端口重定向才行。

2,正在使用迅雷时也会导致xampp套件中的apache无法启动,可以先停掉迅雷。启动后再使用迅雷没问题。

3,如果通过管理面板启动或关闭apache、mysql,请直接运行环境根目录下的apache_start.bat、apache_stop.bat或mysql_start.bat、mysql_stop.bat启动或关闭apache、mysql,这时能看到具体的报错信息

4,如果您启用了组件中的ftp但远程连接时却根本连不上也没任何报错,这时请检查一下您服务器上是否设置了防火墙
XAMPP 的 Windows 版 FAQ

作者:Kay Vogelgesang,
版本:2005 年 10 月 31 日
简体中文版的 FAQ 有待翻译 :)
1. General Questions
XAMPP does not work under Windows XP SP2!
Sure! But here, Microsoft delivered a new firewall. This firewall blocks the important ports 80 (http) and 443 (https) and the server does not want to start (anymore). The fast solution: Deactivate the Microsoft firewall with the toolbar and try to start XAMPP once more.
Of course everybody also can define the own firwall exceptions in the security center. The following ports are needed for a basic functionality:
http 80 (HTTP)
https 443 (SSL)
And for all other servers in XAMPP:
ftp 21
smtp 25
pop3 110
imap 143
AJP/1.3 8009
http-alt 8080 (Tomcat Default Port)
Where I change the start page?
Document is called a folder the $path-to-xampp\xampp\htdocs. There is the index site (index.html) the real start page which is initialized after executing of http://localhost. Alternatively, this page can also be deleted and replaced by “index.php” or “index.cgi” (etc.). The hierarchy of all index pages in the XAMPP be called:
DirectoryIndex index.php index.php4 index.php3 index.cgi index.html index.htm index.html.var index.phtml
Note: After changing that, you will find the XAMPP examples with the URL http://localhost/xampp.
However, I needmod_perl, the Tomcat or Python!
The tools for this exist with the XAMPP AddOns. Note: These additional packages work only the XAMPP main package not with the “xampplite”. At the moment there are the following AddOns:
Perl withmod_perland many DBI drivers for the respective version of XAMPP (Apache)
Tomcat withmod_jk2 but without Java JSDK. The required JSDK for that Addon was published in the download page or in the Readme. You should be installed Java JSDK before installing this AddOn!
Python with mod_python
You find all current AddOns for win32 on the XAMPP win32 download page. Besides that there are even further AddOns for XAMPP on

http:///projects/xamppaddon.

How do I check the md5 checksum?
To check whether the package really is from developer, you need additional Programs. For example the console program md5sum.exe:

http://downloads./contrib/md5sum/Windows/md5sum.exe

So it works:
Put the XAMPP package (e.g. xampp-win32-1.4.16.exe) and MD5 file (e.g. xampp-win32-1.4.16.5) and the md5sum.exe in the same directory
Use the cmd with the following command, here:
md5sum-c xampp-win32-1.4.16.
xampp-win32-1.4.16.exe OK
Otherwise something is wrong. By the way, another GUI program is MD5summer. Please visit their homepage for more information.: http://www.
There are three “php.ini”. Which is now the correct one?
The \xampp\apache\bin\php.ini is the correct one! The others in the \xampp\php directory are only for PHP in CGI/CLI mode. So configure the \xampp\apache\bin\php.ini for web changes.
Modifications in the php.ini will be saved also after the “PHP switch” (the changing of the PHP version). And note: Modifications in the php.ini and in the httpd.conf always need a Apache restart!
Help! The PV.EXE (KILL.EXE) is a Virus in the XAMPP!
No! The “pv.exe” (older the “kill.exe”) is not a Virus or a Trojan. It is a normal utility for killing processes like the kill order for Linux. We need this to stop some server like the Apache. Because the “shutdown/stop” statement do not work here without service installation. But sometimes we make a “hand start” and want to stop the Apache clean.
Problem: Some Virus scans (also like Norton) make warnings here. Because it is the name (“kill”) or perhaps some Virus/Trojan bundles contain a kill program for stopping some unwanted programs.
See also:
Microsoft C 1
Microsoft C 2
Not enough memory in the system environment
This kind of error message occurs only under home systems like Windows 95/98/ME and XP home. Problem: The worse memory administration of the Windows home systems allows not some applications like the “” to work with more memory that 160 kb. But our servers need more, however. Solution: Add the following line to c:\config.sys:
shell=c:\windows\ c:\windows /e:2048 /p
After the restart of your complete system please try XAMPP again. The memory of 2048 kb can be used now. That should be sufficient.
The apache does not start on my system!!!
This problem can be several reasons.
(1) You have started more then one HTTP Server (IIS, Sambar, ZEUS and so on). Only one Server can occupy port 80. So you must terminate one http server, before you start the Apache. Some error messages like this show the problem:
“(OS 10048)… make_sock: could not bind to adress 0.0.0.0:85
no listening sockets available, shutting down”
“(OS 10038)Socket operation on non-socket: make
_sock: for address 0.0.0.0:443, apr_socket_opt_set: (SO_KEEPALIVE)
no listening sockets available, shutting down”
(2) You have Windows 95 with an outdated winsocks or your winsocks is damage. At least the Apache needs winsocks 2. Please download the current winsocks by www.
(3) Sometimes the Winsock2 information has been corrupted by poorly written Internet programs (worms, virus). A Winsock2 Fix written by Tom Kynch can solve this problem (only 95,98,ME).
(4) It runs a firewall, which blocks the Apache port. In this case, some pictures or javascripts cannot load via http://. Sometimes, you must deinstall your firewall completly to fix this problem.
(5) You have XP professional without Service Pack 1. In this case the installation of SP1 is recommended urgently.
(6) You have a Virus Scan from McAffee. Sometimes it makes problems. Deactivate here McAffee for testing of XAMPP.
(7) You have other software, such as the Internet Telephone “SKYPE” which also blocks the port 80. (thanks Peter! ) However, one can change the SKYPE port: Actions — > Options –> Connection. Here remove the check mark at “Port 80″ for an alternate port. Restart Skype and also it should work. (thank Monty! )
Tip: The “xampp-portcheck.exe” displays the status of every essential port of XAMPP. The status “Free” is even free and that is okay.
My CPU load is with the Apache almost by 99%
Please, enable following line = > # Win32DisableAcceptExin the /xampp/Apache/conf/httpd.conf.
In this case correct is: Win32DisableAcceptEx
The newer Apache versions have been an improved Winsock 2 support. But it does not work correctly with the Windows home versions. The statement “Win32DisableAcceptEx” in the httpd.conf deactivate this support. Sometimes, some Windows NT systems make trouble too. We do not know why.
Pictures and style Sheets are not displayed!
With some applications (phpEclipse, phpBB etc.) are problems with displaying great files rpictures. This problem can be solvedin the /xampp/Apache/conf/httpd.confthese lines
# EnableSendfile offstage
# EnableMMAP offstage
Please activate these lines by removing #:
EnableSendfile offstage
EnableMMAP offstage
Apache restart.
Conversly sometimes, from
EnableSendfile offstage
EnableMMAP offstage
you should make
# EnableSendfile offstage
# EnableMMAP offstage
Try it out! Thanks for this solution to the forum and Kris!
This problem is often caused by the program “NetLimiter” for regulating bandwidth. Please see here the thread in our forum

http://www./f/viewtopic.php?t=6195&highlight=netlimiter

for more information.
I would like to install the MySQL server as a service!
I would like to install the MySQL server as a service!
Do only work under with NT, Windows 2000 and Windows XP.
(1) Service installation: Under /xampp/mysql double-click on the “mysql_installservice.bat”.
(2) Service uninstallation: Under /xampp/mysql double-click on the “mysql_uninstallservice.bat”. That is all!
How I can set a “root” password in MySQL? (method 1)
In the \xampp\mysql\bin directory enter into the console:
mysqladmin -u root password secret
Ok, “secret” should be your secret password. Then update the password for PHPMyAdmin. Open the “config.inc.php” in \xampp\phpmyadmin an edit following lines:
INSTEAD OF …
$cfg['Servers'][$i]['user'] = ‘root’;
$cfg['Servers'][$i]['password'] = ”;
NOW …
$cfg['Servers'][$i]['user'] = ‘root’;
$cfg['Servers'][$i]['password'] = ‘secret’;
Ads
Set a new ‘root’ passwort with mysqladmin
How I can set a “root” password in MySQL? (method 2 )
Well, there is still another possibility to set the root password. Start PHPMyAdmin with http://127.0.0.1/phpmyadmin, open the database “mysql” (never delete this!) and use the table “user”. Create here a new user or e.g. simply change the password of “root.” MySQL restart! After that, do not forget to change the password in the “xampp/phpmyadmin/config.inc.php” for PHPMyAdmin.
How I can set a “root” password in MySQL? (method 3 )
This method based on a suggestion by Ruedi from Basel. With that: Thanks and Grüssli to Switzerland!
Tip: Resetting the password can be make also with the /xampp/mysql/resetroot.bat. After that, the password is empty means “”.
Step 1: Run cmd
C:\ program files \apachefriends\xampp\mysql\bin>mysqld-nt –skip-grant-tables
Step 2: Run cmd
C:\>C:\ program files\apachefriends\xampp\mysql\bin\mysqladmin -u rootflush-privileges password “newpwd”
Step 3: Stopping MySQL
C:\>C:\ program files\apachefriends\xampp\mysql\bin\mysqladmin -u root-p shutdown
Enter password: ****** (newpwd)
Step 4: Edit the “config.inc.php” for the access of PHPMyAdmin
C:\ program files\apachefriends\xampp\phpmyadmin\config.inc.php
Here search for “root”
‘$cfg['Servers'][$i]['password'] = ‘newpwd’; // MySQL password
Step 5: MySQL restart
Can I use my own mysql server?
Why not! Simply don’t start the mysql from the xampp package. So you can use your own MYSQL server. Please note! Two servers cannot be started on one same port! If you have set a password for root, please do not forget to edit the “config.inc.php” in \xampp\phpmyadmin for PHPMyAdmin.
Everyone can use PHPMyAdmin from outside!
In the basic configuration of XAMPP, PHPMyAdmin have a public access. You can close this ‘gap’ with the “config.inc.php”. Open the configuration file of PHPMyAdmin and edit the ‘auth_type’ lines:
$cfg['Servers'][$i]['auth_type'] = ‘config’;
$cfg['Servers'][$i]['user'] = ‘root’;
$cfg['Servers'][$i]['password'] = ‘secret’;
Now correctly …
$cfg['Servers'][$i]['auth_type'] = ‘http’;
$cfg['Servers'][$i]['user'] = ‘root’;
$cfg['Servers'][$i]['password'] = ”;
Now, user and password are checked before PHPMyAdmin access the mysql server. Optionally you can set ‘cookie’ for ‘http’.
PHPMyAdmin Login, here cookie based
Where is the IMAP support for PHP?
As default, the IMAP support for PHP is deactivated in XAMPP because there were some mysterious initialization errors by some home versions like Windows 98. Who work with NT systems should open the \xampp\apache\bin\php.ini to active here the php exstension by removing the beginning semicolon.
extension=php_imap.dll
Apache restart! That is the method for all not loaded PHP modules in XAMPP to loading it
I have problems with the reference of some classes in objects
Thank you Jörg to point to that problem! It seems the activation of the “Zend Optimizer” makes trouble here. Please open the \xampp\apache\bin\php.ini and deactivate all lines in the [Zend] section. After that, restart the apache.
Note: In the newer XAMPP versions, the ZEND extension is deactivate as default.
Other free opensource programs (CMS and so on) do not function!
Linux and Windows are different. So the crypt() function does not supported for windows and so on. Also the simple programming can be strange: For example the term ‘var=Text;’ functions in PHP for Linux. But for example for some older PHP for win32 you have to program ‘var=”Text”;’. Or the interfaces are often too different. Or further necessary programmes are missing on other platforms. This is the reason why sometimes certain programmes do not work with XAMPP.
Can I delete the “install” directory after “installation”?
No, better not. The scripts here are still needed for all additional packages (add-ons) and upgrades of XAMPP.
Where is a the front page extension?
We do not know a free extension for the Apache under win32. But there is a “Ready-to-Run FrontPage Server Extensions for Unix”: http://www./fpsupport/.
But often the developer in our forum knowing more: http://www./f/
I would like to move the XAMPP package into another directory!
Hmm … If the “install” directory is present I would try the following: Copy the entire XAMPP package into the new directory of your choice. Then start here again the “setup_xampp.bat” for refresh all configuration files. Test everything! If all servers really still working here, it is okay! If not, then not and you should remove that copy!
How do I activate the eaccelerator?
Please open the “php.ini” in the directory \xampp\apache\bin\php.ini. Here activate the following lines by removing the semicolon in each line in the [eAccelerator] section:
extension=eaccelerator.dll
eaccelerator.shm_size = “0″
eaccelerator.cache_dir = “\xampp\tmp”
eaccelerator.enable = “1″
eaccelerator.optimizer = “1″
After that, don’t forget the restart the Apache HTTPD!
I do not get any connection to my MS SQL server!
If the mssql extension was loaded in the php.ini, sometimes it comes to access problems when only TCP/IP is used. You can fix that problem with a newer “ntwdblib.dll” from Microsoft. Please replace the older file in the \xampp\apache\bin directory with your newer file from Microsoft. Apache restart. Thank you Horst for this topic note!
How do I work with the PHP mcrypt extension?
For this, we have opened a Topic in the forum with examples and also with some problem solutions:
Do Microsoft Activer Server Pages (ASP) work with XAMPP?
No! And Perl:ASP in the Perl Add-on is not the same! Unfortunately no free implementation for the Apache is available.
I would like to use Perl with MOD_PERL!
Therefore you need our XAMPP Perl Add-on with the big Perl Package plus Mod_perl. Please refer our Add-on download section and our Add-on practice section for more information.