macOS使用MAMP集成环境安装Phalcon

凌云

一时兴起装个Phalcon玩玩;环境:
macOS 10.11、mamp version 3.5、php version 7.0.0、shell zsh

1、查看目前的php全局命令来源

which php

再此之前我已经使用brew安装了一个php7.0.11,所以我的php命令源是/usr/local/bin/php,在之后的安装中还需要用到该版本的源码文件;

2、使用mamp的php cli

删除brew安装创建的软链接,替换为mamp

sudo ln -s /Applications/MAMP/bin/php/php7.0.0/bin/php /usr/local/bin/php 

sudo ln -s /Applications/MAMP/bin/php/php7.0.0/bin/phpize /usr/local/bin/phpize 

sudo ln -s /Applications/MAMP/bin/php/php7.0.0/bin/php-config /usr/local/bin/php-config 

sudo ln -s /Applications/MAMP/bin/php/php7.0.0/bin/pecl /usr/local/bin/pecl

3、下载Phalcon

git clone git://github.com/phalcon/cphalcon.git

cd cphalcon/build

sudo ./install

4、错误提示解决

/Applications/MAMP/bin/php/php7.0.0/lib/php/build'. Please check your PHP installation.

将brew安装的php源码目录下的build文件夹下的所有内容copy到mamp源码路径中,你也可以去php.net下载源码复制;

grep: /Applications/MAMP/bin/php/php7.0.0/include/php/main/php.h: No such file or directory
grep: /Applications/MAMP/bin/php/php7.0.0/include/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/MAMP/bin/php/php7.0.0/include/php/Zend/zend_extensions.h: No such file or directory

将brew安装的php源码目录下的include文件夹下的所有内容copy到mamp源码路径中;

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

使用brew安装m4与autoconf即可

brew install m4
brew install autoconf

解决以上文件,再次执行install脚本即可;

5、修改ini文件

修改ini文件

添加extension=phalcon.so

6、确认安装

打印一下

print_r(get_loaded_extensions());

//结果:
Array
(
    [0] => Core
    [1] => date
    [2] => libxml
    [3] => openssl
    [4] => pcre
    [5] => sqlite3
    [6] => zlib
    [7] => bcmath
    [8] => bz2
    [9] => calendar
    [10] => ctype
    [11] => curl
    [12] => dom
    [13] => hash
    [14] => fileinfo
    [15] => filter
    [16] => ftp
    [17] => gd
    [18] => SPL
    [19] => iconv
    [20] => intl
    [21] => json
    [22] => ldap
    [23] => mbstring
    [24] => session
    [25] => standard
    [26] => mysqlnd
    [27] => PDO
    [28] => pdo_mysql
    [29] => pdo_sqlite
    [30] => Phar
    [31] => posix
    [32] => Reflection
    [33] => mysqli
    [34] => SimpleXML
    [35] => soap
    [36] => sockets
    [37] => exif
    [38] => tokenizer
    [39] => wddx
    [40] => xml
    [41] => xmlreader
    [42] => xmlwriter
    [43] => xsl
    [44] => zip
    [45] => apache2handler
    [46] => imap
    [47] => mcrypt
    [48] => pgsql
    [49] => pdo_pgsql
    [50] => phalcon
)

如果输出中有phalcon安装成功;

阅读 4.8k

VikinDev
VikinDev的web之旅!

一只生活在春城的PHP developer

450 声望
9 粉丝
0 条评论

一只生活在春城的PHP developer

450 声望
9 粉丝
文章目录
宣传栏