2014-03-05 57 views
0

在此先感谢您的帮助。 我花了很多时间试图找到解决方案,我通常不会寻求帮助。 服务器上Godaddy.com 这一切都很好,我的本地主机。PHP .DS。在godaddy

<?php require_once("../includes/initialize.php"); ?> 

// this is the initialize.php file 
<?php 

// Define the core paths 
// Define them as absolute paths to make sure that require_once works as expected 

// DIRECTORY_SEPARATOR is a PHP pre-defined constant 
// (\ for Windows,/for Unix) 
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); 

defined('SITE_ROOT') ? null : 
define('SITE_ROOT', DS.'webroot'.DS.'photo_gallery'); 

defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS."includes"); 

// load config file first 
require_once(LIB_PATH.DS."config.php"); 

// load basic functions next so that everything after can use them 
require_once(LIB_PATH.DS.'functions.php'); 

// load core objects 
require_once(LIB_PATH.DS.'session.php'); 
require_once(LIB_PATH.DS.'database.php'); 
require_once(LIB_PATH.DS.'database_object.php'); 
require_once(LIB_PATH.DS.'pagination.php'); 
require_once(LIB_PATH.DS.'phpMailer'.DS.'class.phpmailer.php'); 
require_once(LIB_PATH.DS.'phpMailer'.DS.'class.smtp.php'); 

// load database-related classes 
require_once(LIB_PATH.DS.'user.php'); 
require_once(LIB_PATH.DS.'photograph.php'); 
require_once(LIB_PATH.DS.'comment.php'); 

?> 

这是godaddy上的文件管理器右上角的路径。 的webroot/photo_gallery /包括/ initialize.php

的所有文件都在includes文件夹

这里是错误:)

警告:require_once(/webroot/photo_gallery/includes/config.php) :未能打开流:没有这样的文件或目录在/home/content/43/7465643/html/photo_gallery/includes/initialize.php在线16

以及该网站不会让我回答我自己的问题,所以这里是答案。

感谢Quixrick这里是工作代码:

<?php 
$webroot = "home/content/43/7465643/html/"; 

// Define the core paths 
// Define them as absolute paths to make sure that require_once works as expected 

// DIRECTORY_SEPARATOR is a PHP pre-defined constant 
// (\ for Windows,/for Unix) 
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); 

defined('SITE_ROOT') ? null : 
define('SITE_ROOT', DS.$webroot.DS.'photo_gallery'); 

defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); 

// load config file first 
require_once(LIB_PATH .DS.'config.php'); 

// load basic functions next so that everything after can use them 
require_once(LIB_PATH.DS.'functions.php'); 

// load core objects 
require_once(LIB_PATH.DS.'session.php'); 
require_once(LIB_PATH.DS.'database.php'); 
require_once(LIB_PATH.DS.'database_object.php'); 
require_once(LIB_PATH.DS.'pagination.php'); 
require_once(LIB_PATH.DS.'PHPMailer'.DS.'class.phpmailer.php'); 
require_once(LIB_PATH.DS.'PHPMailer'.DS.'class.smtp.php'); 

// load database-related classes 
require_once(LIB_PATH.DS.'user.php'); 
require_once(LIB_PATH.DS.'photograph.php'); 
require_once(LIB_PATH.DS.'comment.php'); 

?> 

...编程是非常复杂的,但大部分的时间都花在搞清楚你做错了什么。

以及至少对我来说反正:)

+0

这是很清楚的,不是吗?该文件不存在。另外,你可以在Windows和* nix上使用'/'。 – Brad

+0

但该文件确实存在,并且它位于包含文件夹中。所有这些文件都在包含文件夹中。我不能改变.DS。到/因为有使用.DS的方法。而没有定义它,我将不得不把整个事情写下来。 – user3384868

+0

您是否需要在godaddy上安装php或者是否自动安装。我有一天设立了一个新账户,我需要下一个让我的PHP访问服务器上的数据库mySQL。 www.jamesbond.ws是该网站。 – 2014-07-21 12:56:50

回答

1

Web根被设置为webroot而不是/home/content/43/7465643/html。设置此线时可能需要使用变量:

define('SITE_ROOT', DS.'webroot'.DS.'photo_gallery'); 

也许是这样吗?

define('SITE_ROOT', DS.$webroot.DS.'photo_gallery'); 

或者,如果它是一个常数,取出它周围的报价:

define('SITE_ROOT', DS.webroot.DS.'photo_gallery'); 
+0

更像OP的构建Web路径,但在文件系统上下文中使用它。除非站点的webroot真的是文件系统的根目录,否则它应该是'/ path/to/site/document/webroot/....'而不是 –

+0

谢谢生病尝试。 – user3384868

+0

我使用了变量$ webroot =“home/content/43/7465643/html /”;并且在生成错误之前一直到达phpmailer行。它的进步:) – user3384868