如何给我们的应用程序Zend库路径? (Zend框架2.3) [英] How to give zend library path in our application? (In zend framework 2.3)

查看:128
本文介绍了如何给我们的应用程序Zend库路径? (Zend框架2.3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地机器上安装的Zend框架的应用程序。我工作在Ubuntu。
我已经安装了手动,而不使用作曲家。
我给我的httpd.conf中ZF2_PATH(Zend库路径)。如在下面:

I have installed zend skeleton application in my local machine. I am working on ubuntu. I have installed it manually without using composer. I have given the ZF2_PATH(zend library path) in my httpd.conf. as in the below :

<VirtualHost *:80>


ServerAdmin webmaster@localhost
DocumentRoot /var/www/
SetEnv ZF2_PATH /var/www/lib/ZendFramework-2.3.1/library
SetEnv APPLICATION_ENV "development"

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

这是工作的罚款。

我需要把这个code服务器。我没有root权限配置的httpd.conf

I need to put this code on server. I don't have root access to configure the httpd.conf

所以,我怎么可以给application.config.php库路径?
任何帮助将是有益的。

So How can I give the library path in application.config.php? Any help would be useful.

推荐答案

如果mod_env在启用的Apache服务器上,然后只需添加SETENV指令在你的.htaccess文件。
如果未启用mod_env那么你可以编辑init_autoloader.php把它指向正确的文件夹。请参见下面init_autoloader.php的相关部分:

If mod_env is enabled in Apache on the server then just add the SetEnv directive in your .htaccess file. If mod_env is not enabled then you could edit init_autoloader.php to point it to the right folder. See the relevant part of init_autoloader.php below:

$zf2Path = false;

if (is_dir('vendor/ZF2/library')) {
    $zf2Path = 'vendor/ZF2/library';
} elseif (getenv('ZF2_PATH')) {      // Support for ZF2_PATH environment variable or git submodule
    $zf2Path = getenv('ZF2_PATH');
} elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value
    $zf2Path = get_cfg_var('zf2_path');
}

if ($zf2Path) {
    if (isset($loader)) {
        $loader->add('Zend', $zf2Path);
        $loader->add('ZendXml', $zf2Path);
    } else {
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        Zend\Loader\AutoloaderFactory::factory(array(
            'Zend\Loader\StandardAutoloader' => array(
                'autoregister_zf' => true
            )
        ));
    }
}

这篇关于如何给我们的应用程序Zend库路径? (Zend框架2.3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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