php开发环境部署(xampp)

演示环境

系统:centos7
xampp版本:xampp-linux-x64-8.2.4-0-installer.run

安装

文档:XAMPP FAQs for Linux

# 下载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.

内容导览:计算机网络基础、进阶、安全实践

  • 17
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
要配置XAMPP作为php开发环境,您需要按照以下步骤进行操作: 1. 下载XAMPP软件包并安装。XAMPP是一个易于安装和使用的Apache发行版,其中包含了MySQL、PHP和Perl等相关组件。您可以从XAMPP官网下载软件包。 2. 解压缩XAMPP安装文件,并找到安装目录。通常情况下,XAMPP安装目录是在C盘根目录下。 3. 打开安装目录下的apache/conf/httpd.conf文件。您可以使用任何文本编辑器打开此文件。 4. 在httpd.conf文件中找到以下代码段: ```<Directory /> AllowOverride None Require all denied </Directory>``` 5. 将上述代码段修改为: ```<Directory /> AllowOverride All Require all granted </Directory>``` 这将允许.htaccess文件的使用,并允许所有请求进行访问。 6. 保存并关闭httpd.conf文件。 7. 启动XAMPP控制面板,并启动Apache服务。 现在,您已经成功配置了XAMPP作为php开发环境。您可以在浏览器中访问localhost来测试您的php代码。请注意,您还可以根据需要自定义XAMPP的其他配置。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [php开发环境搭建 XAMPP](https://blog.csdn.net/Winterto1990/article/details/52002742)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [PHP开发环境搭建:PHP集成环境XAMPP 的安装与配置](https://blog.csdn.net/guobinhui/article/details/83957573)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hougang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值