[英]publishing zend website issue on goDaddy.com
我正在嘗試將我的 zend 應用程序從本地移動到遠程。在我將所有文件夾上傳到我的 GoDaddy 主機后,這是我的文件夾結構:
/html
/application
/configs
/controllers
/models
/views
bootstrap.php
/library
/public
/css
/images
/js
.htaccess
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'));
//add library directory to include path
set_include_path(implode(PATH_SEPARATOR, array(
dirname(dirname(__FILE__)) . '/library',dirname(dirname(__FILE__)) .
'/application/models',dirname(dirname(__FILE__)) .
'/application/forms',dirname(dirname(__FILE__)) . '/application/views/scripts',
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();
現在,如果我嘗試 go 鍵入此 URL: "www.mysite.com/public/index/index"我收到此錯誤:
The requested URL /public/index/index/ was not found on this server.
Additionally, a 404 Not Found error was encountered while trying
to use an ErrorDocument to handle the request.
如果我只是輸入:“www.mysite.com/public/” ,我會收到以下警告:
Warning: require_once(/home/content/66/6902756/html/application/Bootstrap.php
[function.require-once]: failed to open stream: No such file or directory
in /home/content/66/6902756/html/library/Zend/Application.php on line 320
Fatal error: require_once() [function.require]: Failed opening
required '/home/content/66/6902756/html/application/Bootstrap.php'
(include_path='/home/content/66/6902756/html/application/../library:
/home/content/66/6902756/html/library:
/home/content/66/6902756/html/application/models:
/home/content/66/6902756/html/application/forms:
/home/content/66/6902756/html/application/views/scripts:
.:/usr/local/php5/lib/php')
in /home/content/66/6902756/html/library/Zend/Application.php on line 320
在當地一切正常
更新在我的 index.php 我試過:
//it output "exists"
echo file_exists( '/home/content/66/6902756/html/application/Bootstrap.php' )?'exists':'no file found';
//where '/home/content/66/6902756/html' is my absolute hosting path
謝謝
我敢打賭,您的問題的主要部分是您在包含路徑中使用了\
。 嘗試用常量DIRECTORY_SEPARATOR
替換那些。 就個人而言,我會擺脫所有這些dirname(dirname(__FILE__))
。 而是使用內置的APPLICATION_PATH
:
set_include_path(implode(PATH_SEPARATOR, array(
dirname( APPLICATION_PATH ) . DIRECTORY_SEPARATOR . 'library', //note one exception
APPLICATION_PATH. DIRECTORY_SEPARATOR . 'models',
APPLICATION_PATH. DIRECTORY_SEPARATOR . 'forms',
APPLICATION_PATH. DIRECTORY_SEPARATOR . 'views'. DIRECTORY_SEPARATOR .'scripts',
get_include_path())));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.