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 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答