Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
custom config.php出现问题_Php_Mysql_Sql_Database_Web - Fatal编程技术网

custom config.php出现问题

custom config.php出现问题,php,mysql,sql,database,web,Php,Mysql,Sql,Database,Web,我被要求将一个旧的定制网站(使用php和mysql)迁移到另一台服务器,这让我陷入了困境。我已经更改了配置以反映新位置,但我得到的只是一个白色屏幕。DB连接良好,所以这不是问题所在,我想可能是$doc\u根的问题。有人能帮我写下面的代码吗 $doc_root = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))).""; $DOC_ROOT = str_re

我被要求将一个旧的定制网站(使用php和mysql)迁移到另一台服务器,这让我陷入了困境。我已经更改了配置以反映新位置,但我得到的只是一个白色屏幕。DB连接良好,所以这不是问题所在,我想可能是$doc\u根的问题。有人能帮我写下面的代码吗

$doc_root = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])))."";
$DOC_ROOT = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])))."";
我不太了解php,不幸的是,我被卡住了!当前测试服务器地址的格式为
http://xx.xxx.xx.xx/thedomain.com/

对于$doc_root,我已经尝试了很多以上的组合,但无论我做什么都不会起作用


有人能帮忙吗?提前谢谢

编辑php.ini文件并输入以下行:

error_reporting = E_ALL
这将报告代码出错的确切错误,而不是空白页

另一种方法是运行命令

$php <php-filename>
$php

如果您在此处报告错误,也许可以提供更多帮助。

您可以使用以下代码作为参考:

//Directory sub-folder, if the file is not under the sub-folder leave it blank
//if under a folder add this example ('/folder')
if (!defined("DIRECTORY_FOLDER")) define(DIRECTORY_FOLDER, "");

//DIRECTORY_ROOT is the document root of the file ex: /home/user/public_html
if (!defined("DIRECTORY_ROOT")) define(DIRECTORY_ROOT, $_SERVER["DOCUMENT_ROOT"].DIRECTORY_FOLDER); 

//here is the url of the website
if (!defined("DEFAULT_URL")) define(DEFAULT_URL, "http://".$_SERVER["HTTP_HOST"].EDIRECTORY_FOLDER);

现在,您可以使用默认的URL和目录根作为变量。

试试
$doc\u ROOT=dirname(\uu文件\uuu)成功了,谢谢!!太简单了!谢谢你的建议,但恐怕我试过了,我还是得到了同样的白页。