dongzhi1949 2015-09-21 16:28 采纳率: 100%
浏览 70
已采纳

如何在Bluemix中部署Zend Framework 2

I've deployed ZF2 application in bluemix system. After deployment I reach

Not Found

The requested URL / was not found on this server. error.

After I've added .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^APP_HOST$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.APP_HOST$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

And getting error:

Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. Run php composer.phar install or define a ZF2_PATH environment variable.' in /home/vcap/app/htdocs/init_autoloader.php:53 Stack trace: #0 /home/vcap/app/htdocs/public/index.php(15): require() #1 {main} thrown in /home/vcap/app/htdocs/init_autoloader.php on line 53

I found A CloudFoundry Build Pack for PHP.. I also tried how there described, but no result.

  • 写回答

2条回答 默认 最新

  • dougong9987 2015-09-29 07:48
    关注

    I found the way to deploy any PHP Framework to Bluemix system. I've tested ZF2 and Yii2 frameworks. Add in

    manifest.yml

    buildpack: https://github.com/cloudfoundry/php-buildpack#v3.2.2
      env:
        CF_STAGING_TIMEOUT: 15
        CF_STARTUP_TIMEOUT: 15
    

    Create a htdocs folder. Move all generated project files into this newly created htdocs folder with the exception of these four files:

    1. .gitignore
    2. composer.json
    3. composer.lock
    4. manifest.yml

    Create a new folder in the root of our application named .bp-config. Change directories into this folder and create a new filed named options.json. Within this file, include the following json snippet:

    {
         "PHP_VERSION": "{PHP_55_LATEST}",
         "COMPOSER_VENDOR_DIR": "htdocs/vendor",
         "WEBDIR": "htdocs/public",
         "PHP_EXTENSIONS": [ "bz2", "zlib", "openssl", "fpm", "tokenizer", "curl", "mcrypt", "mbstring", "pdo", "FRAMEWORK NAME"]  
    }
    

    For Zend Framework 2 "FRAMEWORK NAME" to "ZF2", for Yii2 to "Yii2".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 怎样才能让鼠标沿着线条的中心线轨迹移动
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?