博客 / 詳情

返回

配置LNMPHP7.3+phalcon3.4+swoole4.5環境

機器環境 centos7 64bit
機器內存建議至少3GB,否則安裝phalcon的時候會卡主很久.大概5分鐘
目標
配置php7環境
包含

  1. nginx
  2. php7.3
  3. mysql4.7
  4. phalcon3.4
  5. swoole4.5
  6. easyswoole
  7. redis4.4
  8. memcache
  9. beanstalk1.10

切換yum源為阿里雲

CentOS 7 yum源
#刪除repo文件,或者自己備份
rm -rf /etc/yum.repos.d/*.repo 
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
#更新緩存
yum makecache 

安裝nginx+php7.3+mysql4.7

建議使用lnmp一鍵腳本安裝,因為本質是源碼安裝方式,且做了統一的服務管理 安裝目錄等均為統一格式
但是php擴展需要自己手動安裝
但是注意 不建議安裝PureFTPd 和 ProFTPd 和PHPMyAdmin

wget http://soft.vpser.net/lnmp/lnmp1.6.tar.gz -cO lnmp1.6.tar.gz && tar zxf lnmp1.6.tar.gz && cd lnmp1.6 && ./install.shlnmp

安裝成功後,請使用以下命令

LNMP 服務管理命令

  
狀態管理: lnmp {start|stop|reload|restart|kill|status}  
各個程序狀態管理: lnmp {nginx|mysql|mariadb|php-fpm|pureftpd} {start|stop|reload|restart|kill|status}  
Nginx狀態管理:/etc/init.d/nginx {start|stop|reload|restart}  
MySQL狀態管理:/etc/init.d/mysql {start|stop|restart|reload|force-reload|status}  
Memcached狀態管理:/etc/init.d/memcached {start|stop|restart}  
PHP-FPM狀態管理:/etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate}  
Redis狀態管理: /etc/init.d/redis {start|stop|restart|kill}

LNMP相關軟件安裝目錄


Nginx 目錄: /usr/local/nginx/
MySQL 目錄 : /usr/local/mysql/
MySQL數據庫所在目錄:/usr/local/mysql/var/
MariaDB 目錄 : /usr/local/mariadb/
MariaDB數據庫所在目錄:/usr/local/mariadb/var/
PHP目錄 : /usr/local/php/
默認網站目錄 :/home/wwwroot/default/
Nginx日誌目錄:/home/wwwlogs/
Redis 目錄:/usr/local/redis/

LNMP相關配置文件位置


Nginx配置文件:/usr/local/nginx/conf/nginx.conf
添加的site配置文件:/usr/local/nginx/conf/vhost/域名.conf
MySQL配置文件:/etc/my.cnf
PHP配置文件:/usr/local/php/etc/php.ini
php-fpm配置文件:/usr/local/php/etc/php-fpm.conf
Redis 配置文件:/usr/local/redis/etc/redis.conf
查看php擴展目錄  php -i | grep extension_dir
查看pp擴展配置文件  cd /usr/local/php/conf.d

安裝phalcon3.4

如果曾經使用過phalcon2.x,3.x的版本 不建議使用phalcon4.x
因為很多類 和命名空間 都修改了 改動很大
且不兼容低版本.
考慮到已有代碼的穩定性和快速展開業務的效率 不建議使用phalcon4.0

wgete https://codeload.github.com/phalcon/cphalcon/zip/v3.4.3
unzip cphalcon-3.4.3.zip
cd /data/softs/cphalcon-3.4.3/build/php7/64bits
phpize
./configure --with-php-config=/usr/local/src/php7/bin/php-config --enable-phalcon
make && make install

安裝swoole

wget https://codeload.github.com/swoole/swoole-src/zip/v4.5.0

安裝composer

切換鏡像為阿里雲
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

安裝easySwoole

composer require easyswoole/easyswoole=3.x
php vendor/easyswoole/easyswoole/bin/easyswoole install
具體請看esw的文檔 https://www.easyswoole.com/Cn/QuickStart/install.html

安裝beanstalk1.10


wget https://github.com/beanstalkd/beanstalkd/archive/v1.10.zip
tar xzvf beanstalkd-1.10.zip
cd beanstalkd-1.10
make && make install
beanstalkd -v

還沒寫完,,還在繼續編輯中.

user avatar
0 位用戶收藏了這個故事!

發佈 評論

Some HTML is okay.