搭建workerman php环境

一、安装php环境

1、更新yum源

# yum install epel-release -y && yum update -y

2、安装php需要的依赖

# yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel

3、下载php包,并解压编译

# wget https://www.php.net/distributions/php-7.2.18.tar.gz
# tar -zxvf php-7.2.18.tar.gz && cd php-7.2.18
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/conf.d --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --with-gd --with-openssl --with-mhash --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-opcache && make -j 4 && make install
# cp php.ini-production /usr/local/php/etc/php.ini
# sed -i 's/post_max_size =.*/post_max_size = 50M/g' /usr/local/php/etc/php.ini && sed -i 's/upload_max_filesize =.*/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini && sed -i 's/;date.timezone =.*/date.timezone = PRC/g' /usr/local/php/etc/php.ini && sed -i 's/short_open_tag =.*/short_open_tag = On/g' /usr/local/php/etc/php.ini && sed -i 's/;cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini && sed -i 's/max_execution_time =.*/max_execution_time = 300/g' /usr/local/php/etc/php.ini && sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,chgrp,chown,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru/g' /usr/local/php/etc/php.ini
# echo PATH=$PATH:/usr/local/php/bin >> /etc/profile && echo export PATH >> /etc/profile && source /etc/profile

增加一个bin快捷方式

# ln -s /usr/local/php/bin/php /usr/bin/php

3、查看是否符合workerman扩展要求

# curl -Ss http://www.workerman.net/check.php | php

4、安装event扩展,并查看是否安装ok

# wget https://pecl.php.net/get/event-2.5.0.tgz
# tar -zxvf event-2.5.0.tgz && cd event-2.5.0
# /usr/local/php/bin/phpize && ./configure --with-php-config=/usr/local/php/bin/php-config && make && make install
# echo extension=event.so >> /usr/local/php/etc/php.ini
# php -m |grep event

5、安装php uuid扩展

# wget http://pecl.php.net/get/uuid-1.0.4.tgz
# tar zxvf uuid-1.0.4.tgz
# cd uuid-1.0.4
# phpize
# ./configure
# make
# make install
# echo extension=uuid.so >> /usr/local/php/etc/php.ini

6、安装redis扩展

# wget https://pecl.php.net/get/redis-4.3.0.tgz
# tar zxvf redis-4.3.0.tgz
# cd redis-4.3.0
# phpize
# ./configure
# make
# make install
# echo extension=redis.so >> /usr/local/php/etc/php.ini

使redis内网172.16.6.158可访问,编辑/etc/redis.conf
bind 127.0.0.1 172.16.6.158

7、查看所有扩展

# php -m

二、安装Redis

# yum install redis -y
# systemctl start redis
# systemctl enable redis

三、安装mariadb

1、mariadb

# yum install mariadb -y
# systemctl start mariadb
# systemctl enable mariadb

2、修改密码
https://www.jianshu.com/p/cc4af004d6cc

3、开启远程登录
https://www.jianshu.com/p/cc4af004d6cc

四、安装consul,并配置

请参考 https://www.jianshu.com/p/f59c1f28ad3e,https://www.jianshu.com/p/de28dc34e11c

五、yum git

六、安装openresty,orange并配置

# wget https://openresty.org/download/openresty-1.13.6.2.tar.gz
# tar zxvf openresty-1.13.6.2.tar.gz
# cd openresty-1.13.6.2
# ./configure --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module
# make
# make install
# ln -s /usr/local/openresty/bin/resty /usr/sbin/resty
# ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx

进入home文件, 安装orange,lor
参考:https://www.jianshu.com/p/03e6dc6a904b

进入orange目录,运行sh start.sh发现有问题,运行命令

# make dependencies

需安装luarocks

wget http://luarocks.github.io/luarocks/releases/luarocks-2.0.4.1.tar.gz
tar -xzvf luarocks-2.0.4.1.tar.gz
cd luarocks-2.0.4.1/
 ./configure --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
make && make install

再次运行命令

# make dependencies

需安装unzip,yum install unzip
再次执行 make dependencies 于是


image.png

发现依赖都已安装,打开ip:9999,发现可以访问了

你可能感兴趣的:(搭建workerman php环境)