在MacOS Catalina上的M​​AMP中无法在Codeigniter 4中看到我的控制器

问题描述

我正在尝试在运行macOS Catalina的开发机上安装Codeigniter 4 现在,我已经使用CI v3开发了应用程序,但我想迁移到v4,以便进行测试

我正在遵循指南 https://codeigniter.com/user_guide/

我的MAMP安装(MAMP 5.7)已安装PHP 7.4.2和PHPinfo();显示启用了国际扩展

PHP Version 7.4.2

ICU version 56.1

在Composer中安装CI4会给我带来错误

composer create-project codeigniter4/appstarter test_ci4_2

输出

     Installing codeigniter4/appstarter (v4.0.4)
       - Installing codeigniter4/appstarter (v4.0.4): Loading from cache
     Created project in /Users/filippoferrari/Documenti/MAMP/htdocs/test_ci4_2
     Loading composer repositories with package information
     Updating dependencies (including require-dev)
     Your requirements Could not be resolved to an installable set of packages.
     
       Problem 1
         - codeigniter4/framework v4.0.4 requires ext-intl * -> the requested PHP extension intl is missing from your system.
         - codeigniter4/framework v4.0.3 requires ext-intl * -> the requested PHP extension intl is missing from your system.
         - codeigniter4/framework v4.0.2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
        - codeigniter4/framework v4.0.1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
         - codeigniter4/framework 4.0.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.
         - Installation request for codeigniter4/framework ^4 -> satisfiable by codeigniter4/framework[4.0.0,v4.0.1,v4.0.2,v4.0.3,v4.0.4].

所以我切换到“手动”安装。 我在MAMP / htdocs文件夹下创建了一个名为TEST_CI4的文件夹,并将CI4文件放在那里 在App / Config / app.PHP下,我设置了公共$ baseURL ='http:// localhost:8888 / test_ci4_2 /'; (我的Apache在端口8888上运行)

如果我将浏览器指向http:// localhost:8888 / test_ci4 / public /,我会看到codeigniter欢迎页面

但是如果我将浏览器指向http:// localhost:8888 / test_ci4 /,则会看到文件夹结构。

问题在于,按照本教程操作,并在使用http:// localhost:8888 / test_ci4 / pages /打开浏览器时创建“页面”控制器,但出现“ 404 not found”错误

我是否错过了Composer安装会自动完成的一些步骤?

解决方法

“在app文件夹中开发您的应用,公共文件夹将成为您的文档根目录”-CI用户指南

基本上在localhost上,您将始终需要附加公共目录,因为那是您的文档根目录,而index.php,css,javascript等文件将进入该文件夹。

在Web服务器上,它们鼓励您添加应用程序,在文档根目录和public之上的系统文件夹,或在web服务器上的public_html将成为您的根文件夹。同样,在具有域的Web服务器上,您也无需添加公共内容。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...