阿里云linux服务器安装Phalcon-----"phalcon Volt directory can't be written" "gcc: internal compiler error: Killed (program cc1)"

时间:2022-04-08 02:10:26

这里特别蛋疼的一件事是官方英文文档中文文档命令参数略有不同

中文文档:

 //通用平台下安装指定的软件包:
sudo yum install git gcc make pcre-devel php-devel //编译
git clone git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install //添加扩展到你的php配置文件
#Centos/RedHat: Add a file called phalcon.ini in /etc/php.d/ with this content:
extension=phalcon.so

英文文档:

//We need some packages previously installed:
sudo yum install php-devel php-mysqlnd gcc libtool //To create the extension from C source follow these steps:
git clone --depth= git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install //Add the extension to your php.ini:
extension=phalcon.so

我安装的时候是综合这2个文档来,因为半天没弄出来病急乱投胎....

编译的过程中报错:

gcc: internal compiler error: Killed (program cc1)

主要问题是因为内存不足导致的,为解决该问题通过增加swap分区来解决,具体方法如下:

sudo mkdir -p /var/cache/swap/
sudo dd if=/dev/zero of=/var/cache/swap/swap0 bs=1M count=
sudo chmod /var/cache/swap/swap0
sudo mkswap /var/cache/swap/swap0
sudo swapon /var/cache/swap/swap0

参考:http://www.cnblogs.com/Jerryshome/p/4217854.html

PS: 最新版phalcon编译源代码的时候要保证有1G的内存

Phalcon安装完后,访问用Phalcon开发工具自动生成的项目,网页报错:

“phalcon Volt directory can't be written”

解决方法,给app/cache文件夹添加写权限

//我这里直接添加所有访问权限了->->
chmod cache

要保证Apache开启了mod_rewrite,开启方法:

找到httpd.conf文件,将“LoadModule rewrite_module modules/mod_rewrite.so”前面的#去掉
在要支持url rewirte的目录启用 Options FollowSymLinks和AllowOverride All