臧富祥 ^回到顶部

您的当前位置:首页 > 架构 > Linux > linux安装lamp/lnmp环境

linux安装lamp/lnmp环境

所属分类: Linux   2020-03-28 09:38:52  编辑:admin  浏览次数 668 次

软件系统要求

操作系统:全新系统(支持CentOS、Ubuntu、Debian、Fedora、Deepin)等

请确保您的系统是纯静的,未安装任何环境中涉及到的(Apache\Nginx\php\MySQL\FTP)

phpstudy for linux 采用为Docker核心而开发,故此建议使用centos7.xx 系统版本

内存要求:内存要求最低512MB,推荐768MB以上,纯面板约占系统60MB内存

安装方法(phpstudy for linux V0.4公测版)

使用 SSH 连接工具 连接到您的 Linux服务器后,根据系统执行相应命令开始安装(大约2分钟完成面板安装):

Centos安装脚本 yum install -y wget && wget -O install.sh https://download.xp.cn/install.sh && sh install.sh

Ubuntu安装脚本 wget -O install.sh https://download.xp.cn/install.sh && sudo bash install.sh

Deepin安装脚本 wget -O install.sh https://download.xp.cn/install.sh && sudo bash install.sh

Debian安装脚本 wget -O install.sh https://download.xp.cn/install.sh && sudo bash install.sh

上面是phpstudy

下面是宝塔

Centos安装命令:

  1. yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

复制代码


试验性Centos/Ubuntu/Debian安装命令 独立运行环境(py3.7) 可能存在少量兼容性问题 不断优化中  

  1. curl -sSO http://download.bt.cn/install/install_panel.sh && bash install_panel.sh

复制代码


Ubuntu/Deepin安装命令:

  1. wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh

Debian安装命令:

  1. wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh

Fedora安装命令:

  1. wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh


Linux面板7.1.0升级命令:

  1. curl http://download.bt.cn/install/update6.sh|bash


安装swoole

首先下载swoole   https://github.com/swoole/swoole-src/releases/tag/v4.4.16

image.png

执行命令 wget https://github.com/swoole/swoole-src/archive/v4.4.16.tar.gz

下载完成减压 tar -zxvf v4.4.16.tar.gz

cd v4.4.16.tar.gz

编译

image.png

image.png

[root@localhost /]#  cd /root

[root@localhost root]#  tar -xvf swoole-src-4.4.4.tar.gz

[root@localhost root]#  cd swoole-src-4.4.4

[root@localhost swoole-src-4.4.4]#  phpize

[root@localhost swoole-src-4.4.4]#  ./configure

[root@localhost swoole-src-4.4.4]#  make

[root@localhost swoole-src-4.4.4]#  sudo make install

make一下

make install

如下便是执行安装,并且安装到了PHP的环境目录中了;最后执行配置好php.ini在里面添加swoole的扩展即可

[root@localhost swoole-src-4.4.4]# find / -name php.ini
/www/server/php/72/etc/php.ini
[root@localhost swoole-src-4.4.4]# vi /www/server/php/72/etc/php.ini

添加

extension=swoole.so

然后通过php -m检测

配置一下php.ini

image.png

image.png

安装swoole

下载

首先进入swoole的github下载地址:https://github.com/swoole/swoole-src/releases
如果没有特殊需求,请选择最新版本开始下载(我这里是最新版是v4.4.16):

tioncico@tioncico-PC:/tmp$ wget https://github.com/swoole/swoole-src/archive/v4.4.16.tar.gz ## 下载tioncico@tioncico-PC:/tmp$ tar -zvxf v4.4.16.tar.gz  ## 解压到当前目录tioncico@tioncico-PC:/tmp$ cd swoole-src-4.4.16/ ## cd目录tioncico@tioncico-PC:/tmp/swoole-src-4.4.16$ phpize ## 使用phpize创建php编译检测脚本 ./configuretioncico@tioncico-PC:/tmp/swoole-src-4.4.16$ ./configure --with-php-config=/usr/local/php-7.2.2/bin/php-config --enable-openssl  ## 创建编译文件,第一个--with,后面是php的安装路径/bin/php-config ,第二个--enable,是开启swoole的ssl功能tioncico@tioncico-PC:/tmp/swoole-src-4.4.16$sudo make && make install  ## 编译swoole并把编译好的文件移动到php的扩展目录(前面的配置php版本的扩展目录) 需要root权限

这个时候已经安装成功,需要进入php.ini,在最后面增加上:

extension=swoole.so

成功安装swoole,通过php --ri swoole 查看swoole扩展的信息:

tioncico@tioncico-PC:/tmp/swoole-src-4.4.16$ php --ri swoole

swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.4.16Built => Feb 20 2020 11:18:54coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.1.0h  27 Mar 2018pcre => enabled
zlib => 1.2.11mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

到此,swoole安装完毕

常见问题

phpize 命令不存在

安装phpize

yum install php-devel ## centossudo apt-get install php-dev  ## ubuntu

提示swoole.so.so类似的报错

说明你的phpize版本和php-config设定的版本不一致,请重新编译

phpize命令也可以使用绝对路径:php路径/bin/phpize 用于执行
在之后的--with-php-config也得使用同样的路径:php路径/bin/php-config

安装成功 php --ri没有swoole

说明你的php命令行版本,和安装swoole的php版本不一致,可以通过:php路径/bin/php --ri swoole 进行确认是否安装成功 

php -m

image.png


服务器文章检索

服务器文章目录