zoukankan      html  css  js  c++  java
  • linux 下安装配置xampp环境

    Linux系统是centOS 6.5

    1.首先到下载地址下载:https://www.apachefriends.org/download.html

    我下载的是:
    xampp-linux-x64-5.6.24-1-installer.run

    2.把文件拷贝到/usr/local/src目录下,先赋予执行权限,

    [root@localhost src]# chmod a+x xampp-linux-x64-5.5.35-0-installer.run

    3.然后执行(注意一定要在root权限下):

    [root@localhost src]# ./xampp-linux-x64-5.5.35-0-installer.run

    安装过程遇到确认的地方都选择yes就行:

    4.启动xampp

    [root@localhost ~]# cd /opt/lampp
    [root@localhost lampp]# .xampp start
    -bash: .xampp: command not found
    [root@localhost lampp]# ./xampp restart
    Restarting XAMPP for Linux 5.5.35-0...
    XAMPP: Stopping Apache...ok.
    XAMPP: Stopping MySQL...not running.
    XAMPP: Stopping ProFTPD...not running.
    XAMPP: Starting Apache...ok.
    XAMPP: Starting MySQL...ok.
    XAMPP: Starting ProFTPD...ok.

    启动成功后,可以进入linux的图形界面打开一个浏览器,输入localhost,可以看到xampp的主页:

    这里写图片描述

    如果你的linux系统没有图像界面也没有关系,后面会提到如何在局域网中访问php网页,可以在windows电脑上通过浏览器访问。


    另外还有一点,在opt/lampp目录下有lampp和xampp两个执行程序,效果是一样的,执行哪个都可以。

    另外的配置:

    停止xampp

    [root@localhost lampp]# ./lampp stop
    Stopping XAMPP for Linux 5.6.24-1...
    XAMPP: Stopping Apache...ok.
    XAMPP: Stopping MySQL...ok.
    XAMPP: Stopping ProFTPD...ok.
    [root@localhost lampp]# 

    开机启动
    [pony@localhost init.d]$ chkconfig -add xampp 
    -add: 未知的选项
    [pony@localhost init.d]$ chkconfig --add xampp 
    你没有足够权限执行此操作。
    [pony@localhost init.d]$ su root
    密码:
    [root@localhost init.d]# 
    [root@localhost init.d]# chkconfig --add xampp 
    [root@localhost init.d]# chkconfig --list|grep xampp
    xampp           0:关闭  1:关闭  2:关闭  3:启用  4:启用  5:启用  6:关闭
    [root@localhost init.d]# chkconfig --level 3 xampp on
    [root@localhost init.d]# 

    重启系统,然后打开浏览器访问localhost,如果出现了xampp的主页说明访问成功。也可以用chkconfig –list命令查看当前运行的服务有没有xampp。

    卸载xampp

    卸载其实删掉lamp目录就行了。

    [root@localhost /]# /opt/lampp/xampp stop
    Stopping XAMPP for Linux 5.6.24-1...
    XAMPP: Stopping Apache...ok.
    XAMPP: Stopping MySQL...ok.
    XAMPP: Stopping ProFTPD...ok.
    [root@localhost /]# rm -rf /opt/lampp/
    

    局域网其他电脑访问

    网上很多文章说,如果要局域网其他电脑访问,一定要配置
    /opt/lampp/etc/extra/httpd-xampp.conf

    但是我的可以直接访问,我在局域网的一台windows电脑上,输入服务器的地址10.0.0.36,可以打开xampp的主页。

    还有个防火墙的问题,如果你做了配置依然不能访问,看看iptables里的防火墙配置有没有打开80端口。

    新建php页面测试

    在/opt/lampp/htdocs下新建test.php文件,代码如下:

    <?php
    phpinfo();
    ?>

    然后浏览器访问http://localhost/test.php,结果:

    这里写图片描述

    自己在搭建过程中遇到的坑:

    1.安装好xampp和ecshop后,使用浏览器访问ecshop进入配置页面数据库点击搜索一直提示请确认数据库名是否正确,后面就填写随便起的数据库名和后面的内容填写后

    报创建数据库失败,如图:

     问提原因:主要是xampp未启动

    解决办法,启动xampp,此问题成功解决

    2.安装ecshop使用zip格式的包安装后,浏览器访问ecshop进行配置页面显示目录权限全为不可写,导致无法配置安装ecshop?

    解决办法:后面把zip的包更换成tar的包后,此问题得以解决

  • 相关阅读:
    同时使用gitee和github
    vim的四种模式及模式切换
    Vim使用入门
    Vim, Vim Diff, Vim Easy, Vim Read-only 区别
    公钥与私钥
    Linux使用Aria2命令下载BT种子/磁力/直链文件
    Content-Type /AJAX /@ResponseBody
    IDEA 添加serialVersionUID 检查
    Servlet中的Context Path | Servlet Path | Path Info
    第K大的数
  • 原文地址:https://www.cnblogs.com/ycj1295/p/13962650.html
Copyright © 2011-2022 走看看