Phanix
Phanix

Just writing

Installing apache, mysql, php 7.0, php-apcu and Phalcon framework on Centos 7

Record it. Wasting a lot of time by setting permissions =_=

 #install apache2.4 httpd
sudo yum install httpd
sudo systemctl start httpd.service

If you run yum install mysql directly, mariadb will be installed. However, the datetime data format that mariadb can support is a little different from that of mysql, so if you want to use mysql, please follow the following method (refer to this article).

 #install mysql (in this case, we install mysql 5.7). Please not use mariadb, which supports less sudo yum install curl wget
datetime/timestamp data types.
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm 
sudo yum install mysql-server
sudo systemctl start mysqld
sudo mysql_secure_installation

The default of Centos is php 5. If apcu of php5 is used, the installation will be troublesome. It is better to use php 7 directly.

 #install php 7.0
rpm - Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install php70w php70-opache
sudo yum install yum-plugin-replace
sudo yum replace php-common --replace-with=php70w-common
sudo yum install php70w-cli php70w-devel php70w-gd php70w-mbstring php70w-mcrypt php70w-mysql php70w-pecl-apcu php70w-xml gcc libtool pcre-devel git
sudo systemctl restart httpd.service

Some webpages mention that you can install the phalcon framework directly by yum install, but because there is a specific version of php-common tied to it, it is recommended to build it yourself

 #install phalcon framework
git clone --depth=1 "git://github.com/phalcon/cphalcon.git"
cd cphalcon/build/
sudo ./install 

# setting phalcon.so extension in /etc/php.d/phalcon.ini 
sudo nano /etc/php.d/phalcon.ini #put content: extension=phalcon.so

Basically, it's done here. If you install apache2.4 on centos 7, you will directly install the rewrite module. You only need to open the cache/ directory permissions in the phalcon project, but centos 7 is more troublesome because the directory permissions are set compared to ubuntu. It's trivial, so pay attention (refer to https://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/ , to put it bluntly It's the sentence that matters " httpd_sys_content_t – for allowing Apache to serve these contents and httpd_sys_rw_content_t – for allowing Apache to write to those path.”).

 #setting cache/ folder, let apache httpd owns write permission
sudo chown -R apache:apache cache/
ls -Z 
sudo find . -type f -exec chmod 0644 {} \;
sudo find . -type d -exec chmod 0755 {} \;
sudo chcon -t httpd_sys_content_t /var/www/sdk_api/app/cache/ -R
sudo chcon -t httpd_sys_rw_content_t cache/

Original link: Phanix's Blog

CC BY-NC-ND 2.0

Like my work?
Don't forget to support or like, so I know you are with me..

Loading...

Comment