在启用了 PHP 7 和 SELinux 的 CentOS 7 上安装 CakePHP 3.4
这就是我在新安装的最小 CentOS 7 上安装 CakePHP 所做的
- 在 VirtualBox 中安装了 CentOS-7-x86_64-Minimal-1611.iso,两个网络接口:第一个 NAT,第二个仅限主机
- 在/ etc / sysconfig / network-scripts / ifcfg-enp0s3 中设置 ONBOOT = yes
- 重启
- 百胜更新
- yum install net-tools(获取 ifconfig 和 netstat)
- yum install wget
- yum install yum-utils
- wget -q http://rpms.remirepo.net/enterprise/remi-release-7.rpm
- wget -q https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
- yum-config-manager –enable remi-php71
- yum 安装 php
- systemctl 启用 httpd
- systemctl 启动 httpd
- firewall-cmd –permanent –zone = public –add-service = http
- firewall-cmd –permanent –zone = public –add-service = https
- firewall-cmd –reload
- yum 安装 httpd mariadb-server mariadb php phpmyadmin
- systemctl 启动 mariadb
- systemctl 启用 mariadb
- systemctl 重启 httpd
- yum install php-mbstring php-intl
- mysql_secure_installation
- curl -s https://getcomposer.org/installer | PHP
- cd / var / www / html /
- php composer.phar create-project –prefer-dist cakephp / app MyApp
- chown apache:-R MyApp /
- 创建数据库:
# mysql -u root -p
Enter password:
mysql> CREATE DATABASE mydb;
mysql> GRANT ALL ON mydb.* to 'myuser'@'localhost' IDENTIFIED BY '_password_';
mysql> FLUSH PRIVILEGES;
mysql> quit
- 使用内容创建文件/etc/httpd/conf.d/my_app.conf:
<VirtualHost *:80>
ServerAdmin root@localhost
ServerName cakephp.myapp.net
DocumentRoot /var/www/html/MyApp
<Directory /var/www/html/MyApp>
Allowoverride All
</Directory>
</VirtualHost>
-
cd / var / www / html / secure_logging; chcon -Rv –type = httpd_user_content_rw_t tmp
-
触摸/ .autorelabel; 重启
-
在我的主机上我编辑/ etc / hosts 并输入行(192.168.56.101 是我的 VM 的 host-only-ip-address)
192.168.56.101 cakephp.myapp.net
-
待办事项:编辑数据库连接文件。