如何在Bluemix中部署Zend Framework 2 [英] How to Deploy Zend Framework 2 in Bluemix

查看:68
本文介绍了如何在Bluemix中部署Zend Framework 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在bluemix系统中部署了ZF2应用程序.部署后,我到达

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

未找到

在此服务器上找不到请求的URL/.错误.

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

添加.htaccess文件后:

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]

并出现错误:

致命错误:带有消息的未捕获异常'RuntimeException' '无法加载ZF2.运行php composer.phar install或定义一个 ZF2_PATH环境变量."在 /home/vcap/app/htdocs/init_autoloader.php:53堆栈跟踪:#0 /home/vcap/app/htdocs/public/index.php(15):require()#1 {main}抛出 在第53行的/home/vcap/app/htdocs/init_autoloader.php中

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

我找到了一个适用于PHP的CloudFoundry构建包..我也尝试过那里的描述,但没有结果.

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

推荐答案

我找到了将任何PHP Framework部署到Bluemix系统的方法.我已经测试了ZF2和Yii2框架. 添加

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

manifest.yml

manifest.yml

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

创建一个 htdocs 文件夹.将所有生成的项目文件移动到这个新创建的 htdocs 文件夹中,以下四个文件除外:

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
  1. .gitignore
  2. composer.json
  3. composer.lock
  4. manifest.yml

在我们应用程序的根目录中创建一个名为 .bp-config 的新文件夹.将目录更改到此文件夹中,并创建一个名为 options.json 的新文件.在此文件中,包含以下json代码段:

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"]  
}

对于Zend Framework 2 框架名称" "ZF2" ,对于 Yii2 "Yii2"

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

这篇关于如何在Bluemix中部署Zend Framework 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆