【问题标题】:123-reg upgraded, now PHP include has stopped working123-reg 升级,现在 PHP 包含已停止工作
【发布时间】:2021-03-28 00:10:27
【问题描述】:

我的网站使用 PHP 包含将各种内容作为 .html 文件引入,并将它们转储到我的主页中。它工作完美——直到我的主机“升级”了我的包,现在它完全停止工作了。当他们修改后,他们移动了所有内容,现在保存所有内容的文件夹已更改。这可能是路径问题,但我已经更新了 .htaccess 并且它仍然无法正常工作。我在我的索引文件中尝试了一些技巧,但仍然不起作用。噩梦!

谁能帮忙?

谢谢!

<html>    
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link href="_CustomCSS/CustomCSS.css" rel="stylesheet" type="text/css">
    <?php include_path = ".:/home/MyUserName/public_html/" ?>
    <?php define("HTTP_ROOT1", "http://www.tunedinevents.co.uk"); ?>
    <link href="<?=HTTP_ROOT1?>/__Testing/Include_PHP/_CustomCSS/Include_Red_CSS.css" rel="stylesheet" type="text/css">
    <link href="<?=HTTP_ROOT1?>/__Testing/Include_PHP/_CustomCSS/Include_Green_CSS.css" rel="stylesheet" type="text/css">
    <link href="<?=HTTP_ROOT1?>/__Testing/Include_PHP/_CustomCSS/Include_Blue_CSS.css" rel="stylesheet" type="text/css">
</head>

<body>
   <?php include_path = ".:/home/MyUserName/public_html/" ?>
   <div class="<?php include $_SERVER['DOCUMENT_ROOT'].'/__Testing/Include_PHP/_CustomCSS/Include_Red_CSS.html'; ?>"></div>
   <div class="<?php include $_SERVER['DOCUMENT_ROOT'].'/__Testing/Include_PHP/_CustomCSS/Include_Green_CSS.html'; ?>"></div>
   <div class="<?php include $_SERVER['DOCUMENT_ROOT'].'/__Testing/Include_PHP/_CustomCSS/Include_Blue_CSS.html'; ?>"></div>
   <div class="Class_Box_1" id="ID_Text_Red">If PHP works properly, this text will be Red</div>
   <div class="Class_Box_2" id="ID_Text_Green">If PHP works properly, this text will be Green</div>
   <div class="Class_Box_3" id="ID_Text_Blue">If PHP works properly, this text will be Blue</div>
</body>
</html> 

【问题讨论】:

  • 您能提供您当前的 .htaccess 吗?
  • #AddType application/x-httpd-php .htm .html DirectoryIndex index.html index.htm index.shtml index.php index.cgi index.wml indexHomepage.html php_value include_path ".:/home /MyUserName/public_html/"
  • 哦,现场测试页面在这里:tunedinevents.co.uk/__Testing/Include_PHP
  • 当我测试该页面并查看控制台时,我收到此错误:%3C:1 加载资源失败:服务器响应状态为 404(未找到)Hmmmmmmmm.....我以为404少了什么???这根本没有意义
  • include_path 在我看来很可疑。你确定前面的.: 应该在那里吗?

标签: php html


【解决方案1】:

Aaaaaa 答案是......终于从一个知道他们在 123-reg 谈论什么的人那里得到了一些体面的技术支持......(我希望他们从一开始就告诉我这个) .....请鼓乐大师.....

AddHandler 应用程序/x-httpd-alt-php70___lsphp .php .htm .html

那个 - 在 .htaccess 中突然出现

我实际上将它用作块的一部分以确保更加确定:

#AddType application/x-httpd-php .htm .html DirectoryIndex index.html index.htm index.shtml index.php index.cgi index.wml AddHandler 应用程序/x-httpd-alt-php70___lsphp .php .htm .html

一百万年后,我永远不会知道这行简单的代码。我可以编写基本的 html、css 和 JS.... PHP 和 Handlers 是一个全新的球赛。

我真的希望这可以帮助任何阅读本文寻找相同解决方案的人。 “70”表示您在托管包中指定的 PHP 版本。为此,请登录您的 Hosting CPanel。 70 是 PHP 7.0,71 是 PHP 7.1 等等

工作的html代码到底:

<html>


<head>

          <meta charset="utf-8" />
    
          <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />

          <meta http-equiv="X-UA-Compatible" content="IE=edge" />

      
      <link href="_CustomCSS/CustomCSS.css" rel="stylesheet" type="text/css">
      
      
     <?php define("HTTP_ROOT", "http://www.tunedinevents.co.uk");?>  
     
     
  <?php include $_SERVER['DOCUMENT_ROOT'].'/__Testing/Include_PHP/_CustomCSS/Include_Red_CSS.html'; ?>
  
  <?php include $_SERVER['DOCUMENT_ROOT'].'/__Testing/Include_PHP/_CustomCSS/Include_Green_CSS.html'; ?>
  
  <?php include $_SERVER['DOCUMENT_ROOT'].'/__Testing/Include_PHP/_CustomCSS/Include_Blue_CSS.html'; ?>


 </head>



<body>
   

  <div class="Class_Box_1" id="ID_Text_Red">If PHP works properly, this text will be Red</div>
  
  <div class="Class_Box_2" id="ID_Text_Green">If PHP works properly, this text will be Green</div>
  
  <div class="Class_Box_3" id="ID_Text_Blue">If PHP works properly, this text will be Blue</div>

  
</body>

      

</html> 
猜你喜欢
  • 1970-01-01
  • 2013-11-10
  • 2017-03-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-12
  • 2015-10-08
  • 1970-01-01
相关资源
最近更新 更多