ubuntu 14.04安裝phalcon的php框架简单教程以及出錯解决

出錯信息 Error building : fatal error: pcre.h: No such file or directory
解決 sudo apt-get install libpcre3-dev

[非常重要]編譯安裝完phalcon還要把extension=phalcon.so添加到php的配置中
ubntu系統上的php扩展的配置添加和xp上不一样 不是直接修改php.ini文件
添加配置 echo 'extension=phalcon.so' | sudo tee -a /etc/php5/mods-available/phalcon.ini
启用phalcon模块 sudo php5enmod phalcon
重启apache2 sudo service apache2 restart

命令行查看phalcon模块:php -i | grep phcon

系統ubuntu 14.04 64bit
參考 [url]http://stackoverflow.com/questions/22555561/error-building-fatal-error-pcre-h-no-such-file-or-directory[/url]
[url]http://askubuntu.com/questions/440825/cant-install-phalcon-extention-on-ubuntu[/url]
[url]http://phalconphp.com/zh/download[/url]

phalcon框架使用简单入门教程
git clone https://github.com/phalcon/tutorial.git phalcon-tutorial
cd phalcon-tutorial
目录结构
[quote]phalcon-tutorial/
app/
controllers/
models/
views/
public/
css/
img/
js/
[/quote]
ubuntu的apache要配置开启rewrite模块
sudo a2enmod rewrite
具体的rewrite规则看文件tutorial/.htaccess和tutorial/public/.htaccess
添加phalcon-tutorial/public到apache的vhost虚拟机
sudo vi /etc/apache2/sites-available/phalcon5.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName phalcon5.com
DocumentRoot /var/www/phalcon-tutorial/public
<Directory /var/www/phalcon-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

启动设置的phalcon5.conf虚拟机:sudo a2ensite phalcon5
sudo service apache2 reload
echo '127.0.0.1 phalcon5.com' | sudo tee /etc/hosts
浏览器访问看看~~ 是不是看到了"hello"~~

phalcon的入口引导文件 tutorial/public/index.php

phalcon入门参考教程 http://docs.phalconphp.com/en/latest/reference/tutorial.html
参考:https://github.com/phalcon/phalcon-devtools/blob/master/README.md


[后记]假如你的网络有问题可以先添加host
87.98.253.214 packagist.org #autohosts
87.98.253.108 getcomposer.org #autohosts
获取host方法:dig @8.8.8.8 packagist.org +short

假如你使用composer比较普遍 可以直接把 curl -s http://getcomposer.org/installer | php
后的compser.phra文件复制到PATH的目录中如
sudo cp composer.phra /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
cd phalcon-code
composer install #可直接安装
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值