ZEND 类未在生产服务器上加载

发布于 2024-10-22 05:00:52 字数 1326 浏览 1 评论 0原文

我将该网站从共享服务器转移到专用服务器,但该网站无法正常工作。我收到的错误为“致命错误:未捕获异常‘Zend_Db_Adapter_Exception’,并显示消息‘此适配器需要 PDO 扩展,但扩展未加载’”;

结果:

if (extension_loaded('pdo') and extension_loaded('pdo_mysql')) {
        print "Success";
        } else {
        print "Failure";
        }

也是错误的。

------索引文件------

<?php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();

站点链接:http://voxsun.com 网站 phpinfo: http://voxsun.com/public/info.php

谢谢, 拉利特

I shifted the site from shared server to dedicated server but the site is not working correctly. I am getting the error as "Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'The PDO extension is required for this adapter but the extension is not loaded' in ";

Result for:

if (extension_loaded('pdo') and extension_loaded('pdo_mysql')) {
        print "Success";
        } else {
        print "Failure";
        }

is also false.

------Index File------

<?php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();

Link of the site: http://voxsun.com
phpinfo of site: http://voxsun.com/public/info.php

Thanks,
Lalit

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

韬韬不绝 2024-10-29 05:00:52

phpinfo() 的第一行我们可以读到:

'./configure' '--disable-pdo' 

嗯,这是不言自明的。

如果您自己编译 PHP,我真的建议您使用包管理器来执行此操作(aptitude、yum 等),它将简化您的系统升级并避免您每次都手动编译它您需要更新 PHP。
仅当您有非常充分的理由时才这样做。

In the first line of your phpinfo() we can read:

'./configure' '--disable-pdo' 

Well, it's self-explanatory.

If you compiled PHP yourself, I really advise you to use your package manager to do so (aptitude, yum, etc.), it'll ease your system upgrade and avoid you to compile it hand each time you need to update PHP.
Do it only if you've very good reasons.

遗忘曾经 2024-10-29 05:00:52

从你的info.php ... 配置命令'./configure''--disable-pdo'所以简单地说,php在编译时并没有考虑到pdo。

一种选择是在脚本开始时尝试在 public/index.php 中手动加载扩展(我不希望它起作用,但值得一试):

dl('pdo.so');
dl('pdo_mysql.so');

PHP: dl - 在运行时加载 PHP 扩展

From the you're info.php ... Configure Command './configure' '--disable-pdo' so put it simple, php wasn't compiled with pdo in mind .

One option would be to try and load the extensions manualy in public/index.php at the start of you're script ( i don't expect it to work but it's worth giving it a try ) :

dl('pdo.so');
dl('pdo_mysql.so');

PHP: dl - Loads a PHP extension at runtime

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文