演示环境
系统:centos7
xampp版本:xampp-linux-x64-8.2.4-0-installer.run
安装
# 下载xampp文件,上传到 linux主机
# 添加可执行权限
[root@192 ~]# ll xampp-linux-x64-8.2.4-0-installer.run
-rw-r--r--. 1 root root 157746191 10月 29 17:00 xampp-linux-x64-8.2.4-0-installer.run
[root@192 ~]# chmod +x xampp-linux-x64-8.2.4-0-installer.run
[root@192 ~]# ll xampp-linux-x64-8.2.4-0-installer.run
-rwxr-xr-x. 1 root root 157746191 10月 29 17:00 xampp-linux-x64-8.2.4-0-installer.run
# 安装
[root@192 ~]# ./xampp-linux-*-installer.run
----------------------------------------------------------------------------
Welcome to the XAMPP Setup Wizard.
----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.
XAMPP Core Files : Y (Cannot be edited)
XAMPP Developer Files [Y/n] :Y
Is the selection above correct? [Y/n]: Y
----------------------------------------------------------------------------
Installation Directory
XAMPP will be installed to /opt/lampp
Press [Enter] to continue:
----------------------------------------------------------------------------
Setup is now ready to begin installing XAMPP on your computer.
Do you want to continue? [Y/n]: Y
----------------------------------------------------------------------------
Please wait while Setup installs XAMPP on your computer.
Installing
0% ______________ 50% ______________ 100%
#########################################
----------------------------------------------------------------------------
Setup has finished installing XAMPP on your computer.
安装目录: /opt/lampp
网站目录:/opt/lampp/htdocs
启动
启动报错
[root@192 ~]# /opt/lampp/lampp start
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
id: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/share/xampp/xampplib: 第 11 行:test: -ne: 期待一元表达式
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
XAMPP: /opt/lampp/share/xampp/xampplib:行22: netstat: 未找到命令
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/opt/lampp/share/xampp/xampplib:行22: netstat: 未找到命令
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/httpd: error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
XAMPP: hostname: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory
/opt/lampp/share/xampp/xampplib:行22: netstat: 未找到命令
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
XAMPP: /opt/lampp/share/xampp/xampplib:行22: netstat: 未找到命令
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[root@192 ~]#
解决参考:https://54sakuramiku.medium.com/centos7-lampp-cannot-open-shared-object-file-no-such-file-or-directory-c9d16558aee9 仍然报错如下:
[root@192 ~]# sed -i 's/LD_ASSUME_KERNEL=2.2.5/LD_ASSUME_KERNEL=2.8.0/g' /opt/lampp/lampp
[root@192 ~]# /opt/lampp/lampp start
Starting XAMPP for Linux 8.2.4-0...
XAMPP: Starting Apache.../opt/lampp/share/xampp/xampplib:行22: netstat: 未找到命令
/opt/lampp/share/xampp/xampplib:行22: netstat: 未找到命令
ok.
XAMPP: Starting MySQL.../opt/lampp/share/xampp/xampplib:行22: netstat: 未找到命令
ok.
XAMPP: Starting ProFTPD.../opt/lampp/share/xampp/xampplib:行22: netstat: 未找到命令
ok.
[root@192 ~]# /opt/lampp/bin/mysql.server:行262: log_success_msg: 未找到命令
安装netstat再次尝试
[root@192 ~]# yum install -y net-tools
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 net-tools.x86_64.0.2.0-0.25.20131004git.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=====================================================================================================================================================================
Package 架构 版本 源 大小
=====================================================================================================================================================================
正在安装:
net-tools x86_64 2.0-0.25.20131004git.el7 base 306 k
事务概要
=====================================================================================================================================================================
安装 1 软件包
总下载量:306 k
安装大小:917 k
Downloading packages:
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm | 306 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1
验证中 : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1
已安装:
net-tools.x86_64 0:2.0-0.25.20131004git.el7
完毕!
[root@192 lampp]# /opt/lampp/lampp start
Starting XAMPP for Linux 8.2.4-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
[root@192 lampp]# /opt/lampp/bin/mysql.server:行262: log_success_msg: 未找到命令
解决上述报错
参考:log_success_msg: command not found #初心者 - Qiita
编辑:/opt/lampp/bin/mysql.server文件
修改前:
92 #
93 # Use LSB init script functions for printing messages, if possible
94 # Include non-LSB Red Hat init functions to make systemctl redirect work
95 init_functions="/etc/init.d/functions"
96 lsb_functions="/lib/lsb/init-functions"
97 if test -f $lsb_functions; then
98 . $lsb_functions
99 fi
100
101 if test -f $init_functions; then
102 . $init_functions
103 else
104 log_success_msg()
105 {
106 echo " SUCCESS! $@"
107 }
108 log_failure_msg()
109 {
110 echo " ERROR! $@"
111 }
112 fi
修改后:
92 #
93 # Use LSB init script functions for printing messages, if possible
94 # Include non-LSB Red Hat init functions to make systemctl redirect work
95 init_functions="/etc/init.d/functions"
96 lsb_functions="/lib/lsb/init-functions"
97 if test -f $lsb_functions; then
98 . $lsb_functions
99 fi
100
101 if test -f $init_functions; then
102 . $init_functions
103 else
104 log_success_msg()
105 {
106 echo " SUCCESS! $@"
107 }
108 log_failure_msg()
109 {
110 echo " ERROR! $@"
111 }
112 fi
113
114 log_success_msg()
115 {
116 echo " SUCCESS! $@"
117 }
118 log_failure_msg()
119 {
120 echo " ERROR! $@"
121 }
再试尝试启动服务成功
[root@192 lampp]# vi /opt/lampp/bin/mysql.server
[root@192 lampp]#
[root@192 lampp]# /opt/lampp/lampp stop
Stopping XAMPP for Linux 8.2.4-0...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...ok.
XAMPP: Stopping ProFTPD...ok.
[root@192 lampp]# /opt/lampp/lampp start
Starting XAMPP for Linux 8.2.4-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
[root@192 lampp]#
停止
[root@192 ~]# /opt/lampp/lampp stop
Stopping XAMPP for Linux 8.2.4-0...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...ok.
XAMPP: Stopping ProFTPD...ok.
[root@192 ~]#
访问地址
http://server_id(本次测试服务器ip地址为192.168.21.129)
软件版本确认
# apache
[root@192 bin]# /opt/lampp/bin/apachectl -v
Server version: Apache/2.4.56 (Unix)
Server built: Apr 6 2023 08:02:30
# mysql(MariaDB)
[root@192 bin]# /opt/lampp/bin/mysql -V
/opt/lampp/bin/mysql Ver 15.1 Distrib 10.4.28-MariaDB, for Linux (x86_64) using readline 5.1
# php
[root@192 bin]# /opt/lampp/bin/php --version
PHP 8.2.4 (cli) (built: Apr 6 2023 08:21:45) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.4, Copyright (c) Zend Technologies
[root@192 bin]# /opt/lampp/bin/apachectl --v
httpd (pid 34114) already running
[root@192 bin]# /opt/lampp/bin/apachectl -v
Server version: Apache/2.4.56 (Unix)
Server built: Apr 6 2023 08:02:30
# perl
[root@192 bin]# /opt/lampp/bin/perl -v
This is perl 5, version 34, subversion 1 (v5.34.1) built for x86_64-linux-thread-multi
Copyright 1987-2022, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.