MAC 上的 CakePHP 安装
CakePHP Installation on MAC
我是 MacOS 新手。我已成功安装 MAMP 并尝试通过终端安装 CakePHP,但出现以下错误:
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.1.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.9 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.8 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.7 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.6 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.5 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.4 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.3 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.0-beta3 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.0-beta2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.0-beta1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.0-alpha2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.0-alpha1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.0-RC2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.0-RC1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/cakephp 3.0.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.
- Installation request for cakephp/cakephp ~3.0 -> satisfiable by cakephp/cakephp[3.0.0, 3.0.0-RC1, 3.0.0-RC2, 3.0.0-alpha1,
3.0.0-alpha2, 3.0.0-beta1, 3.0.0-beta2, 3.0.0-beta3, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.0.9, 3.1.x-dev, 3.0.x-dev].
错误报告说 "intl" 扩展未在您的 Web 服务器上启用或安装。
只需几个步骤即可在 MAMP 上修复它。 Here 解释了如何做到这一点。
我们可以使用 docker 代替 mamp 或安装 apache 和 php。
将您的项目文件夹指定为 docker 容器的卷。
我正在使用:docker-apache-php
https://github.com/romeOz/docker-apache-php
我正在使用外部数据库,但我们可以使用此图像构建一个新的 docker 图像以添加 mysql
最好的方法是Docker。
在您的应用程序中创建文件 docker-compose.yml:
version: "3.1"
services:
php-fpm:
image: webdevops/php-nginx:7.4
container_name: myapp-webserver
working_dir: /app
volumes:
- ./:/app
environment:
- WEB_DOCUMENT_ROOT=/app/webroot
ports:
- "80:80"
mysql:
image: mysql:5.6
container_name: myapp-mysql
working_dir: /app
volumes:
- .:/app
- ./tmp/data/mysql_db:/var/lib/mysql
env_file:
- mysql.env
command: mysqld --character-set-server=utf8 --init-connect='SET NAMES UTF8;'
ports:
- "3306:3306"
创建文件mysql.env
MYSQL_ROOT_PASSWORD=password
MYSQL_DATABASE=my_app
MYSQL_USER=my_user
MYSQL_PASSWORD=password
执行 docker-compose 以启动服务并访问 http://localhost 上的应用程序。
接下来您需要做的是使用正确的凭据更新您的数据库配置 - 主机是服务名称,在我们的例子中是“mysql”:
'host' => ‘mysql’,
'username' => 'my_user',
'password' => ‘password’,
'database' => 'my_app'
现在可以执行了
docker-compose exec php-fpm bin/cake
我是 MacOS 新手。我已成功安装 MAMP 并尝试通过终端安装 CakePHP,但出现以下错误:
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.1.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.9 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.8 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.7 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.6 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.5 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.4 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.3 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.2 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.1 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.0-beta3 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.0-beta2 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.0-beta1 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.0-alpha2 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.0-alpha1 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.0-RC2 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.0-RC1 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.0.0 requires ext-intl * -> the requested PHP extension intl is missing from your system. - Installation request for cakephp/cakephp ~3.0 -> satisfiable by cakephp/cakephp[3.0.0, 3.0.0-RC1, 3.0.0-RC2, 3.0.0-alpha1, 3.0.0-alpha2, 3.0.0-beta1, 3.0.0-beta2, 3.0.0-beta3, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.0.9, 3.1.x-dev, 3.0.x-dev].
错误报告说 "intl" 扩展未在您的 Web 服务器上启用或安装。
只需几个步骤即可在 MAMP 上修复它。 Here 解释了如何做到这一点。
我们可以使用 docker 代替 mamp 或安装 apache 和 php。
将您的项目文件夹指定为 docker 容器的卷。
我正在使用:docker-apache-php https://github.com/romeOz/docker-apache-php
我正在使用外部数据库,但我们可以使用此图像构建一个新的 docker 图像以添加 mysql
最好的方法是Docker。
在您的应用程序中创建文件 docker-compose.yml:
version: "3.1"
services:
php-fpm:
image: webdevops/php-nginx:7.4
container_name: myapp-webserver
working_dir: /app
volumes:
- ./:/app
environment:
- WEB_DOCUMENT_ROOT=/app/webroot
ports:
- "80:80"
mysql:
image: mysql:5.6
container_name: myapp-mysql
working_dir: /app
volumes:
- .:/app
- ./tmp/data/mysql_db:/var/lib/mysql
env_file:
- mysql.env
command: mysqld --character-set-server=utf8 --init-connect='SET NAMES UTF8;'
ports:
- "3306:3306"
创建文件mysql.env
MYSQL_ROOT_PASSWORD=password
MYSQL_DATABASE=my_app
MYSQL_USER=my_user
MYSQL_PASSWORD=password
执行 docker-compose 以启动服务并访问 http://localhost 上的应用程序。
接下来您需要做的是使用正确的凭据更新您的数据库配置 - 主机是服务名称,在我们的例子中是“mysql”:
'host' => ‘mysql’,
'username' => 'my_user',
'password' => ‘password’,
'database' => 'my_app'
现在可以执行了
docker-compose exec php-fpm bin/cake