紀錄一下。被權限設定浪費不少時間 =_=
#install apache2.4 httpd sudo yum install httpd sudo systemctl start httpd.service
如果直接 yum install mysql 的話,會裝 mariadb。但是 mariadb 可以 support 的 datetime 資料格式跟 mysql 的還是有點不一樣,所以如果要用 mysql 的話請按照下面方式(參考https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-7)。
#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
Centos 預設是 php 5,如果用 php5 的 apcu 的話,安裝又是個麻煩,還不如直接用 php 7。
#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
有別網頁提到可以直接 yum install 來安裝 phalcon framework,不過因為有綁特定版本的 php-common,所以建議自己 build
#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
大致上到這邊就完工了,centos 7上頭安裝 apache2.4會直接有安裝 rewrite module,只要打開 phalcon project 裏頭的 cache/ 目錄權限就可以,但是 centos 7 比較麻煩的是目錄權限設定比起 ubuntu 要來得瑣碎,所以要注意一下(參考https://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/,講白了就是這句話很重要”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/