总结
豆包 AI 助手文章总结

php7.0 + phalcon 安装配置

不言
发布: 2018-04-26 14:42:05
原创
2641人浏览过

本篇文章介绍的是关于php7.0 + phalcon 安装配置,现在分享给大家,有需要的朋友可以看一看


php7.0 + phalcon 安装配置

一、安装lnmp环境

 

1.1  更新阿里源

Ubuntu默认使用的是国外的源,将其替换成国内的阿里的源,脚本

立即学习PHP免费学习笔记(深入)”;

sudo cp /etc/apt/sources.list  /etc/apt/sources.list.bak

sudo sh -c 'cat /etc/apt/sources.list.bak | egrep -v"#|^$" | sed "s/hk.archive.ubuntu.com/mirrors.aliyun.com/g">/etc/apt/sources.list'

sudo apt-get update

1.2  安装mysql

sudo apt-get install mysql-client mysql-server –y

密码默认为password

1.3  安装nginx

sudo apt-get install nginx-full -y

1.4  安装PHP7.0 和phalcon 等扩展

参考链接https://docs.phalconphp.com/zh/latest/reference/install.html

参考链接https://docs.phalconphp.com/zh/latest/reference/nginx.html

1)  安装PHP

sudo apt-getinstall php7.0* -y

生成phalcon框架的apt源

curl -shttps://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh |sudo bash

2)  安装phalcon 框架

sudo apt-getinstall php7.0-phalcon –y

3)  安装phalcon 扩展工具

cd  ~

git clone https://github.com/phalcon/phalcon-devtools.git

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

sudo chmod +x /usr/bin/phalcon

   删除不兼容的php7.0-snmp 的包

      测试工具是否正常

jifan@ubuntu:~$phalcon --help

PhalconDevTools (3.1.2)

Availablecommands:

  info             (alias of: i)

  commands         (alias of: list, enumerate)

  controller       (alias of: create-controller)

  module           (alias of: create-module)

  model            (alias of: create-model)

  all-models       (alias of: create-all-models)

  project         (alias of: create-project)

  scaffold         (alias of: create-scaffold)

  migration        (alias of: create-migration)

  webtools         (alias of: create-webtools)

  console          (alias of: shell, psysh)

jifan@ubuntu:~$

显示正常

二、配置nginx+php-fpm

2.1 配置nginx

移除默认的配置

sudo mv/etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak

添加新的nginx配置

cd /etc/nginx/conf.d

编辑一个新文件zktx.conf

sudo vim zktx.conf

将如下内容复制进去:

server {
    listen     80 default;
    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/php7.0-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;
    }
}
登录后复制

创建默认目录mkdir -p root       /var/www/phalcon/public;

 

2.2 添加一个phpinfo的文件

sudo sh -c "echo '' >/var/www/phalcon/public/index.php"

2.3 启动

sudo service nginx restart

sudo service php-fpm restart

2.4 测试

成功:

2.5 开机自起

编辑/etc/rc.local文件,配置如下:

#!/bin/sh-e

#

#rc.local

#

# Thisscript is executed at the end of each multiuser runlevel.

# Makesure that the script will "exit 0" on success or any other

# valueon error.

#

# Inorder to enable or disable this script just change the execution

# bits.

#

# Bydefault this script does nothing.

/etc/init.d/nginxstart

/etc/init.d/php7.0-fpmstart

 

exit 0

 相关推荐:

php和Apache安装配置实例分享

Mysql5.7.17之winx64.zip解压缩版安装配置图文教程

以上就是php7.0 + phalcon 安装配置的详细内容,更多请关注php中文网其它相关文章!

PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
最新问题
豆包 AI 助手文章总结
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号