在啟用了 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

  • 瀏覽 http://cakephp.myapp.net/

  • 待辦事項:編輯資料庫連線檔案。