2017年8月16日 星期三

laravel 4.2 心得

安裝PHP memcached(非memcache)

錯誤:
Class 'Memcached' not found
# yum install php-pecl-memcached

PHP 5.4升級5.5

環境:centOS 7.1
http://www.techoism.com/how-to-upgrade-php-version-5-4-to-5-5-on-centosrhel/
移除舊的php
# yum remove php-common
安裝PHP 5.5和其套件
# yum -y install php55w php55w-opcache
# yum -y install php55w-xml php55w-mcrypt php55w-gd php55w-devel php55w-mysql php55w-intl php55w-mbstring
安裝其餘必要擴展
# yum install php55w-fpm
# yum install php55w-pecl-memcache
# yum install php55w-pecl-memcached
重啟php-fpm
# service php-fpm restart

安裝redis

https://www.linode.com/docs/databases/redis/install-and-configure-redis-on-centos-7
# yum install redis
啟動redis
# systemctl start redis
開機自動啟動redis(可選)
# systemctl enable redis
測試redis是否安裝成功
# redis-cli ping
PONG

安裝supervisor

# yum install python-setuptools
# yum install supervisor
配置
# vim /etc/supervisord.conf
[include]
files = supervisord.d/*.ini
files = supervisord.d/*.conf
# vim /etc/supervisord.d/your.conf
[program:ga2-main]
command = php /laravel_path/artisan queue:listen ga2-main
process_name = %(program_name)s_%(process_num)s
numprocs = 1
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/ga2-main.log

啟動supervisor
# service supervisord start
停用supervisor
# service supervisord stop

檢查是否有跑
# ps aux | grep supervisord
root     14983  0.3  0.2 223064  2696 ?        Ss   12:25   0:01 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.conf
# ps aux | grep ga2-main
root     16471  0.1  2.1 411032 22236 ?        S    12:26   0:00 php /laravel_path/artisan queue:listen ga2-main

勿用pip或 easy_install 安裝,測試安裝後啟動不了supervisor
移除用pip或easy_install安裝的supervisor
# pip uninstall supervisor
列出systemd的unit files
# systemctl list-unit-files




沒有留言:

張貼留言