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 參考 http://stackoverflow.com/questions/22555561/error-building-fatal-error-pcre-h-no-such-file-or-directory http://askubuntu.com/questions/440825/cant-install-phalcon-extention-on-ubuntu http://phalconphp.com/zh/download
phalcon框架使用简单入门教程 git clone https://github.com/phalcon/tutorial.git phalcon-tutorial cd phalcon-tutorial 目录结构
phalcon-tutorial/ app/ controllers/ models/ views/ public/ css/ img/ js/
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
启动设置的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 #可直接安装