php框架phalcon7安装

环境

linux/macos,gcc,phpize,php-config

安装

  • 下载源码文件 git clone --depth=1 git://github.com/dreamsxin/cphalcon7.git

  • 编译文件 phpize

  • 编译 ./configure

  • 生成 make && make install

  • 添加扩展到配置文件

验证

php --ri phalcon7

目录结构

  app/
    controllers/
    models/
    views/
  public/
    css/
    img/
    js/
    index.php

伪静态配置

# test/public/.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
server {
    listen      80;
    server_name localhost.dev;
    root        /var/www/phalcon/public;
    index       index.php index.html index.htm;
    charset     utf-8;

    location / {
        try_files $uri $uri/ /index.php?_url=$uri&$args;
    }

    location ~ \.php {
        fastcgi_pass  unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index /index.php;

        include fastcgi_params;
        fastcgi_split_path_info       ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /\.ht {
        deny all;
    }
}

创建phalcon脚手架

ln -s ~/cphalcon7/devtools/phalcon.php /usr/bin/phalcon

chmod ugo+x /usr/bin/phalcon

生成phalcon框架

phalcon create-project store