简体   繁体   中英

Symfony 2.3.5 Fatal error: Class 'ResourceBundle' not found on Server

I'm using NameCheap host server with PHP Version 5.3.27 and no intl extension installed.

Although I try to put this lines in php.ini it still not work.

[PHP]
detect_unicode = off
suhosin.executor.include.whitelist="phar"
date.timezone=Europe/Berlin
short_open_tag = off
magic_quotes_gpc = off
extension=pdo.so
extension=pdo_mysql.so

extension=intl.so
extension=php_intl.dll

[intl]
intl.default_locale = en_utf8
intl.error_level = E_WARNING

So, when I execute my web, I have this issue:

FatalErrorException: Error: Class 'ResourceBundle' not found in /home/esdrhazc/vendor/symfony/symfony/src/Symfony/Component/Intl/ResourceBundle/Reader/BinaryBundleReader.php line 31

To avoid this problem I added next lines to autoload.php

use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;

/**
 * @var ClassLoader $loader
 */
$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->registerPrefixFallbacks(
    array(__DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs')
);

}

$loader->add('Gestor', __DIR__.'/../src');

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

return $loader;

What more can I do? Its strange because if i navigate inside host, the previous path doesn't exist, the corrects are:

/../vendor/symfony/symfony/src/Symfony/Component/Locale/stubs

but I try to change it and it still doesn't work. And, I can't find functions.php .

In case there isn't a solution, which host can I use?

Thanks in advance.

As other people have suggested, you need intl extension. You have two options the first one is to use native c intl extension. Installation will depend on your operating system. Second option is to use symfony intl extension written in php . To install php extension just add

"symfony/intl": "2.5.6"

to the require section in your composer.json file. If the native intl extension is not available sf2 will failover to use php version instead. You can read more: here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM