blackarcanis
blackarcanis

Reputation: 542

Include Zend In Symfony 2

I have a problem for including Zend Framework in Symfony 2 IN PRODUCTION, because when i use it on local there is no problem ...

I just commited my work on my production server and i have this error :

Fatal error: Class 'Zend_Gdata_AuthSub' not found

And there is this error for any classes of Zend Framework ... This is my autoload which is good for localhost :

<?php
use Doctrine\Common\Annotations\AnnotationRegistry;

$loader = require __DIR__.'/../vendor/autoload.php';

// intl
if (!function_exists('intl_get_error_code')) {
    require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';

    $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
    $loader->add('Zend_', __DIR__.'/../vendor/zf/library');
}

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
set_include_path(__DIR__.'/../vendor/zf/library'.PATH_SEPARATOR.get_include_path());
return $loader;
?>

There is probably a problem with the include path but i don't know why ...

Thanks a lot !

Upvotes: 1

Views: 1811

Answers (1)

dkcwd
dkcwd

Reputation: 569

If you want to use Composer to pull in the components you need from ZF2 then you could use the information at Zend Framework site Composer info page

As an example you can add code like this to your composer.json file to enable the repository:

"repositories": [
    {
        "type": "composer",
        "url": "https://packages.zendframework.com/"
    }
],


"require": {
"zendframework/zend-config": "2.0.*",
"zendframework/zend-http": "2.0.*"
},

You place the names of the packages you want to pull in under the "require" section and the list of available packages is at the link I supplied so you can check the names there. When you go to install the dependencies you can use this command:

php composer.phar install

Does that help? :-)

Upvotes: 2

Related Questions