安装php phalcon扩展

一、安装需要的工具包,如果有了就不要安装了

#Ubuntu

sudo apt-get install php5-dev php5-mysql gcc libpcre3-dev


#Fedora

sudo yum install php-devel php-mysqlnd gcc libtool


#RHEL

sudo yum install php-devel php-mysql gcc libtool


#Suse

yast2 -i php5-pear php5-devel php5-mysql gcc


#OS X (Using Homebrew)

brew tap homebrew/dupes

brew tap homebrew/versions

brew tap homebrew/php

brew install php5x php5x-phalcon # Where "x" - minor number of PHP

二、下载

git clone --depth=1 git://github.com/phalcon/cphalcon.git

三、安装

cd cphalcon/build

sudo ./install

如果出现以下错误

Cannot find config.m4. 

Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module


configure: error: Cannot find php-config. Please use --with-php-config=PATH

可修改 install文件

将phpize和./configue �Cenable-phalcon分别修改为

/usr/local/php/bin/phpize和./configue �Cenable-phalcon �Cwith-php-config=/usr/local/php/bin/php-config (这里按照自己的php安装路径填写)

安装成功

Build complete.

Don't forget to run 'make test'.


Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/


Thanks for compiling Phalcon!

Build succeed: Please restart your web server to complete the installation

四、添加php扩展

编辑php.ini添加一行

extension=phalcon.so

重启php

phpinfo()查看下发现phalcon扩展已经添加成功。

还有种情况可能会报如下警告

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/phalcon.so' - /usr/lib64/php/modules/phalcon.so: undefined symbol: php_json_decode_ex in Unknown on line 0

这是因为和json扩展加载顺序冲突导致的

解决方法:

不要在php.ini里加入extension=phalcon.so这行,可在php.d文件夹下创建新文件phalcon.ini,在phalcon.ini里加入extension=phalcon.so这行,重启php,发现扩展加上了

phalcon官方安装文档http://phalconphp.com/zh/download


你可能感兴趣的:(安装php,phalcon扩展)