gpt4 book ai didi

php - 为什么 DOCUMENT_ROOT 与远程服务器上的实际路径 ('.' 不同)

转载 作者:行者123 更新时间:2023-12-04 14:48:55 24 4
gpt4 key购买 nike

echo realpath('.').'<br>';
echo dirname(__FILE__).'<br>';
echo realpath(dirname(__FILE__)).'<br>';
echo $_SERVER[PHP_SELF].'<br>';
echo getcwd();

我总是得到

/services2/webpages/util/i/g/gg8375620.provider.com.br/mydomain.com/public

但是在 phpinfo 中 DOCUMENT_ROOT 是

/services/webpages/l/i/mydomain.com/public

因此,我很难将 .htaccess 与 Zend Framework 结合使用。

在我的本地我能够让它工作。但在提供商主机上,我还无法领会其中的魔力。

美国东部时间:我把 $_SERVER['DOCUMENT_ROOT'] = realpath($_SERVER['DOCUMENT_ROOT']); 放在索引文件上但得到了这个。

Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'parse_ini_file(/services2/webpages/util/i/g/gg8375620.provider.com.br/mydomain.com/public/v0.2b/application/configs/appkeys.ini) [function.parse-ini-file]: failed to open stream: No such file or directory parse_ini_file(/services2/webpages/util/i/g/gg8375620.provider.com.br/mydomain.com/public/v0.2b/application/configs/appkeys.ini) [function.parse-ini-file]: failed to open stream: No such file or directory' in /services2/webpages/util/i/g/gg8375620.provider.com.br/mydomain.com/public/v0.2b/library/Zend/Config/Ini.php:181 Stack trace: #0 /services2/webpages/util/i/g/gg8375620.provider.com.br/mydomain.com/public/v0.2b/library/Zend/Config/Ini.php(201): Zend_Config_Ini->_parseIniFile('/services2/webp...') #1 /services2/webpages/util/i/g/gg8375620.provider.com.br/mydomain.com/public/v0.2b/library/Zend/Config/Ini.php(125): Zend_Config_ in /services2/webpages/util/i/g/gg8375620.provider.com.br/mydomain.com/public/v0.2b/library/Zend/Config/Ini.php on line 181

美国东部时间:就是这样:

$appkeys = new Zend_Config_Ini(APPLICATION_PATH . '/configs/appkeys.ini');

APPLICATION_PATH 由

定义
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

最佳答案

试试这个:

$_SERVER['DOCUMENT_ROOT'] = realpath($_SERVER['DOCUMENT_ROOT']);
echo $_SERVER['DOCUMENT_ROOT'] . "\n";

并阅读 this

关于php - 为什么 DOCUMENT_ROOT 与远程服务器上的实际路径 ('.' 不同),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5281515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com