发布于 2014-12-12 07:59:21 | 9299 次阅读 | 评论: 1 | 来源: PHPERZ

这里有新鲜出炉的精品教程,程序狗速度看过来!

XAMPP PHP开发集成软件包

XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建 XAMPP 软件站集成软件包。这个软件包原来的名字是LAMPP,但是为了避免误解,最新的几个版本就改名为 XAMPP 了。它可以在Windows、Linux、Solaris、M ac OS X 等多种操作系统下安装使用,支持多语言:英文、简体中文、繁体中文、韩文、俄文、日文等。


本文为大家讲解的是在windows下安装xampp集成环境包及常见问题的解决方法,感兴趣的同学参考下.

XAMPP简介

XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建 XAMPP 软件站集成软件包。这个软件包原来的名字是LAMPP,但是为了避免误解,最新的几个版本就改名为 XAMPP 了。它可以在Windows、Linux、Solaris、M ac OS X 等多种操作系统下安装使用,支持多语言:英文、简体中文、繁体中文、韩文、俄文、日文等。

XAMPP安装

当你下载好XAMPP的安装包后我们就先来安装它,如下图:

要选择过安装路径的就在这里选择,最好是不要有中文命名的路径哦……

在这里可能要稍微等久点,它已经在给你安装所有必备的软件呢……

恩,到这里也没啥好说的,那接下来就看看我们是否有安装成功了。。。

按着途中红框的顺序来,1、2步骤是Start启动Apache和MySQL。如果启动没问题的话就会显示红框3,点击红框3就会跳出如下页面:

那恭喜你,你这就算成功安装好了XAMPP了……

But, 很多朋友往往不会有那么顺利的运气。要不是Apache启动不了,就是MySQL启动不了。这时候别着急,应为最常遇到的问题也就那几个,要不是端口号被 限制就是权限未开放。先查看报错提示信息和日志,我们一步一步来排查,下图中红色框框的就是它们的日志信息。

1、Apache无法启动一般报错:

[Apache] Error: Apache shutdown unexpectedly. 
[Apache] This may be due to a blocked port, missing dependencies, 
[Apache] improper privileges, a crash, or a shutdown by another method. 
[Apache] Check the "/xampp/apache/logs/error.log" file 
[Apache] and the Windows Event Viewer for more clues

这就是你的80端口或是443端口被占用了。被谁给占用了呢?cmd中输入:netstat -ano查看

然后再到任务管理器上找想对应的PID进程,如上图占用80端口的是PID为4的进程。如果任务管理器中未显示PID的话,就从选项菜单中去点击显示,如上 图操作。。。对比找到相应进程关闭。麻烦吗?那也可以直接在cmd中输入tasklist命令来打印显示,然后再输入taskkill /pid 端口号 杀掉此进程,XAMPP重启apache即可。

这系统进程怎么能关闭呢?那就应该是被IIS服务给占用咯,所以呢,你可以到服务中看看,如果下图出现这货的话,那就果断把它给关闭且设置成手动启动,要不然每次开机后你都得再把它关闭一次。

一般来说是都可以解决的。什么!还是不行吗?应该不会这么衰吧!那兄弟,你还是换个端口号吧~请到你的XAMPP安装路径下,找到apache\conf\httpd 打开该文件。如下图:

找到Listen和ServerName 来,修改端口号……

2、MySQL报错:

这个报错就有多种多样了,具体得你打开log日志依据报错信息去查找。我这就只举两个比较坑的例子。

①例子一:

2014-11-10 16:02:34 3344 [Note] Plugin 'FEDERATED' is disabled.
2014-11-10 16:02:34 d14 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2014-11-10 16:02:34 3344 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-11-10 16:02:34 3344 [Note] InnoDB: The InnoDB memory heap is disabled
2014-11-10 16:02:34 3344 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2014-11-10 16:02:34 3344 [Note] InnoDB: Memory barrier is not used
2014-11-10 16:02:34 3344 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-11-10 16:02:34 3344 [Note] InnoDB: Not using CPU crc32 instructions
2014-11-10 16:02:34 3344 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2014-11-10 16:02:34 3344 [Note] InnoDB: Completed initialization of buffer pool
2014-11-10 16:02:34 3344 [ERROR] InnoDB: C:\xampp\mysql\data\ibdata1 can't be opened in read-write mode
2014-11-10 16:02:34 3344 [ERROR] InnoDB: The system tablespace must be writable!
2014-11-10 16:02:34 3344 [ERROR] Plugin 'InnoDB' init function returned error.
2014-11-10 16:02:34 3344 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2014-11-10 16:02:34 3344 [ERROR] Unknown/unsupported storage engine: InnoDB
2014-11-10 16:02:34 3344 [ERROR] Aborting

从日志中可以发现红字部分,告诉我们无法读和写ibdatal文件。。。要是文件无法读写的话,那就应该是你管理者的权限问题啦,解决方法呢是找到xampp的安装目录把此文件夹下的内容都设置为管理者拥有最高的权限。

②例子二(此例也是很多朋友遇到过的,原先mysql都能运行可是后来由于非正常关闭后导致启动不了):

2014-11-10 17:28:30 3144 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace phpmyadmin/pma_users uses space ID: 6 at filepath: .\phpmyadmin\pma_users.ibd. Cannot open tablespace wordpress/wp_commentmeta which uses space ID: 6 at filepath: .\wordpress\wp_commentmeta.ibd
InnoDB: Error: could not open single-table tablespace file .\wordpress\wp_commentmeta.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf

上面已经很明确的告诉了我们是表空间损坏了,也许正是因为上一次的非正常操作导致了ibdatal存储表空间结构的文件出现了问题。那该怎么解决呢?人家不是告诉你了么,If the table is not needed, or you can restore it from a backup,then you can remove the .ibd file。如果你的数据表没啥子重要的话,就直接删除它(xampp\mysql\data\ibdatal)。

或者说找到\xampp\mysql\bin\my.cnf文件,当 innodb表空间损坏时候,启动不了,可以强制启动:my.cnf文件中[mysql]下添加innodb_force_recovery=1或者4。

起来后innodb类型的表不能写操作,但可以读,此时做一次check,查找到异常的表,读取出来,导入到myisam表里面,drop原表。然后在 my.cnf中去掉innodb_force_recovery的设置,重启mysql,把myisam表转成innodb表。

恩,以上就是XAMPP的安装过程与常遇到的问题。



最新网友评论  共有(1)条评论 发布评论 返回顶部
绿绿很有用 发布于2015-11-02 14:42:55
很有用
支持(2)  反对(1)  回复

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务