带有unix的JPATH Base

时间:2014-11-20 14:51:59

标签: php joomla

嗨,我想知道是否有人可以帮助我。

我正在尝试在我的joomla网站和PHP应用程序之间实现单点登录,该应用程序附带了JBASE指令必须设置的说明,如:

// change the following line to point to your Joomla 3.1 installation
define('JPATH_BASE', "c:\\xampp\\htdocs\\joomla31\\" );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

正如您所看到的,这是针对Windows IIS设置而我使用的是Linux,我尝试过:

define('JPATH_BASE', "\home\sites\jkgsoft.com\public_html\rent360" );

然后得到以下错误:

Warning: require_once(\home\sites\jkgsoft.com\public_html ent360/includes/defines.php): failed to open stream: No such file or directory in /home/sites/jkgsoft.com/public_html/rent360/portal/include/appsettings.php on line 453 Fatal error: require_once(): Failed opening required '\home\sites\jkgsoft.com\public_html ent360/includes/defines.php' (include_path='.:/usr/share/pear53:/usr/share/php:/usr/share/ZendFramework') in /home/sites/jkgsoft.com/public_html/rent360/portal/include/appsettings.php on line 453

有谁知道如何改变这个JPATH?

2 个答案:

答案 0 :(得分:0)

您可以使用__DIR__。它将为您提供服务器的根路径

define('JPATH_BASE',  __DIR__ . "/rent360" ); 

这是一个PHP 5.3解决方案

答案 1 :(得分:0)

您应该使用realpathdirname,如下所示:

define('JPATH_BASE', realpath(dirname(__FILE__) . '../../../rent360'));