Home  >  Article  >  Backend Development  >  php7.0 + phalcon installation configuration

php7.0 + phalcon installation configuration

不言
不言Original
2018-04-26 14:42:052503browse

This article introduces the installation and configuration of php7.0 + phalcon. Now I share it with you. Friends in need can take a look.


php7.0 + Phalcon installation and configuration


1. Install lnmp environment

1.1 Update Ali source

Ubuntu uses by default Replace foreign sources with domestic Alibaba sources, script

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 Install mysql

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

The default password is password

1.3 Install nginx

sudo apt-get install nginx-full -y

1.4 Install extensions such as PHP7.0 and phalcon

Reference link https://docs.phalconphp.com/zh/latest/reference/install.html

Reference link https://docs.phalconphp.com/zh/latest/reference/nginx.html

1) Install PHP

sudo apt-getinstall php7.0* -y

Generate apt source of phalcon framework

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

2) Install the phalcon framework

sudo apt-getinstall php7.0-phalcon –y

3) Install the phalcon extension tool

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

Delete the incompatible php7.0-snmp package

Test whether the tool is normal

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:~$

Displays normally

2. Configure nginx+php-fpm

2.1 Configure nginx

Remove the default configuration

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

Add a new nginx configuration

cd /etc/nginx/conf.d

Edit a new file zktx.conf

sudo vim zktx.conf

will Copy the following content into it:

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;
    }
}

Create the default directory mkdir -p root /var/www/phalcon/public;

2.2 Add a phpinfo file

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

2.3 Start

sudo service nginx restart

sudo service php-fpm restart

2.4 Test

successful:


2.5 Boot automatically Start

Edit the /etc/rc.local file and configure it as follows:

#!/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

Related recommendations:

php and Apache installation and configuration examples sharing

winx64.zip solution for Mysql5.7.17 Compressed version installation and configuration graphic tutorial




The above is the detailed content of php7.0 + phalcon installation configuration. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn