0

私は Zend Framework に慣れていません。サーバーを godaddy ホスティングに変更しています。ドメイン名も変更しました。ファイルをアップロードした後、www.abc.com でこのエラーが発生しますが、他のホストでは正常に動作していました。

私のルートディレクトリは次のようになります。

application
htdocs
library
-Zend

このエラーについて教えてください:

Warning: require_once(Zend/Application.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/37/10289737/html/index.php on line 17
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Application.php' (include_path=':.:/usr/local/php5_3/lib/php') in /home/content/37/10289737/html/index.php on line 17

私のindex.phpファイルは次のようになります

<?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'
   );

     $options = $application->getOptions();
       $db = Zend_Db::factory($options['resources']['db']['adapter'], array(
'host' => $options['resources']['db']['params']['host'],
 'username' => $options['resources']['db']['params']['username'],
 'password' => $options['resources']['db']['params']['password'],
   'dbname' => $options['resources']['db']['params']['dbname']
     ));

//$db=Zend_Db_Table::getDefaultAdapter();

$db->beginTransaction();
   $sql = file_get_contents(APPLICATION_PATH . '/data/data.sql');
 $db->query($sql);
 $db->commit();

 $application->bootstrap()
   ->run();

そして、php.iniファイルを見つけることができません。

4

1 に答える 1

0

include_path にパスを追加しようとしています:

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

ほら、これはあなたのエラー情報からのものです:

include_path=':.:/usr/local/php5_3/lib/php'

そのため、以下のコードは機能しません

realpath(APPLICATION_PATH . '/../library')

index.php ファイルはどこにありますか? htdocs ディレクトリにありますか? たぶん、godaddy は、php スクリプトが htdocs の下のファイルにアクセスする許可を与えませんか?

于 2013-01-09T12:19:06.997 に答える