代码之家  ›  专栏  ›  技术社区  ›  Aman Maurya

如何在cakephp 3项目webroot中运行cakephp3项目

  •  0
  • Aman Maurya  · 技术社区  · 7 年前

    我想运行位于cakephp3项目webroot中的cakephp3项目

    /example.com/
      bin/
      config/
      logs/
      plugins/
      src/
      tests/
      tmp/
      vendor/
      webroot/ 
         /uat/ (this is another project placed inside webroot)
           bin/
           config/
           logs/
           plugins/
           src/
           tests/
           tmp/
           vendor/
           webroot/ 
           ...
           ...
           ...
      .gitignore
      .htaccess
      .travis.yml
      composer.json
      index.php
      phpunit.xml.dist
      README.md
    

    我正试图用这个地址访问另一个项目 https://example.com/uat/index.php ,但它抛出错误:

    找不到UAT类

    2018-08-07 12:54:53 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Uat could not be found.
    Request URL: /uat/index.php
    Stack Trace:
    #0 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/ControllerFactory.php(72): Cake\Http\ControllerFactory->missingController(Object(Cake\Network\Request))
    #1 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(93): Cake\Http\ControllerFactory->create(Object(Cake\Network\Request), Object(Cake\Network\Response))
    #2 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/BaseApplication.php(83): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
    #3 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(Cake\Http\Runner))
    #4 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php(62): Cake\Http\Runner->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
    #5 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(Cake\Http\Runner))
    #6 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php(93): Cake\Http\Runner->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
    #7 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(Cake\Http\Runner))
    #8 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php(81): Cake\Http\Runner->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
    #9 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(Cake\Http\Runner))
    #10 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(51): Cake\Http\Runner->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
    #11 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Server.php(92): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
    #12 /home/corpveda/public_html/webroot/index.php(37): Cake\Http\Server->run()
    #13 {main}
    

    这是为我们的团队设置uat服务器所必需的,我还通过修改 .htaccess接口 在webroot文件夹中找到文件以使其正常工作,但每次都抛出相同的错误。

    1 回复  |  直到 7 年前
        1
  •  0
  •   Knout    7 年前

    我认为这是你最好的选择: https://book.cakephp.org/3.0/en/plugins.html

    推荐文章