搭建workerman php環(huán)境

一、安裝php環(huán)境

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內(nèi)網(wǎng)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、修改密碼
http://www.itdecent.cn/p/cc4af004d6cc

3、開啟遠(yuǎn)程登錄
http://www.itdecent.cn/p/cc4af004d6cc

四、安裝consul,并配置

請參考 http://www.itdecent.cn/p/f59c1f28ad3e,http://www.itdecent.cn/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

進(jìn)入home文件, 安裝orange,lor
參考:http://www.itdecent.cn/p/03e6dc6a904b

進(jìn)入orange目錄,運行sh start.sh發(fā)現(xiàn)有問題,運行命令

# 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
再次執(zhí)行 make dependencies 于是


image.png

發(fā)現(xiàn)依賴都已安裝,打開ip:9999,發(fā)現(xiàn)可以訪問了

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容