跳转到内容


Kerisy framework 2.0 环境搭建 Debian & php 7.0 & swoole & apcu & memcached

Kerisy Debian php swoole

  • 您无法回复此主题
No replies to this topic

#1 冰力

    Administrator

  • 总版主
  • 1280 帖子数:

发表于 2016/02/01 14:31:18

我们使用的 Debian 版本是 8.3,Debian 的 sid 源本来就有 php 7.0 的支持,所以很方便。

add code to /etc/apt/source.list
deb http://mirrors.163.com/debian/ sid main

run command
apt update
apt install php7.0-cli php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-opcache

安装swoole / apcu / memcached 扩展之前要安装 php 的开发环境包
apt install php7.0-dev

自行下载并且编译安装

cd /tmp/
wget http://pecl.php.net/get/swoole-1.8.0.tgz
tar xvf swoole-1.8.0.tgz
cd swoole-1.8.0
phpize
./configure
make && make install

cd ..
wget http://pecl.php.net/get/apcu-5.1.3.tgz
tar xvf apcu-5.1.3.tgz
cd apcu-5.1.3
phpize
./configure
make && make install

cd ..
# 编译 php memcached 扩展依赖这两个包装一下
apt install pkg-config libmemcached-dev libmemcachedutil2
git clone https://github.com/php-memcached-dev/php-memcached.git
cd php-memcached
git checkout php7
phpize
./configure
make && make install

最后添加对应的 *.ini 文件到 /etc/php/7.0/cli/conf.d/ 目录即可。

swoole.ini
extension=swoole.so

apcu.ini
extension=apcu.so

memcached.ini
extension=memcached.so


查看PHP版本信息

root@dolaris:/tmp# php --version
PHP 7.0.2-3 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
	with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

再看看安装的扩展是不是有了 swoole / apcu / memcached
root@dolaris:/tmp# php -m
[PHP Modules]
apcu
bcmath
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mcrypt
memcached
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
SimpleXML
soap
sockets
SPL
standard
swoole
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

进入 kerisy 的 php 目录运行试试看吧:)
cd /data/web/app
kerisy server run