简体   繁体   English

自定义config.php的问题

[英]Issue with custom config.php

I have been dropped in the deep end by being asked to migrate an OLD custom built website (using php and mysql) to another server. 我被要求将一个旧的自定义构建网站(使用php和mysql)迁移到另一台服务器上,这使我陷入了深渊。 I have changed the config to reflect the new location but all I get is a white screen. 我已经更改了配置以反映新的位置,但是我得到的只是一个白屏。 The DB connects fine so that isn't the issue, I think it might be with the $doc_root. 数据库连接细所以这不是问题,我想可能是与$ doc_root的。 Can anyone help with the code below? 谁能帮忙下面的代码?

$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'])))."";

I dont know php too well unfortunately so I am stuck! 不幸的是,我不太了解php,所以我被卡住了! The current test server address is in this format http://xx.xxx.xx.xx/thedomain.com/ 目前的测试服务器地址是这种格式http://xx.xxx.xx.xx/thedomain.com/

I have tried so many combinations of the above for the $doc_root but whatever I do won't work. 我已经试过了上述这么多的组合为$的doc_root但无论我将无法正常工作。

Can anyone help? 有人可以帮忙吗? Thanks in advance! 提前致谢!

Edit your php.ini file and enter the following line: 编辑您的php.ini文件并输入以下行:

error_reporting = E_ALL

This will report the exact error as to where your code is going wrong instead of a blank page. 这将报告有关代码出问题的确切错误,而不是空白页。

Another method is to run the the command 另一种方法是运行命令

$php <php-filename>

If you report the error here, maybe then one can help you more. 如果您在此处报告错误,也许可以为您提供更多帮助。

You could use this code for reference: 您可以使用以下代码作为参考:

//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);

You can use now the DEFAULT_URL and the DIRECTORY_ROOT as a variable. 您现在可以将DEFAULT_URL和DIRECTORY_ROOT用作变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM