V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Taxila
V2EX  ›  PHP

在网站上安装 MediaWiki 结束后显示 Warning: Cannot modify header information 如何解决?

  •  
  •   Taxila · 2018-10-05 03:16:51 +08:00 · 3653 次点击
    这是一个创建于 2271 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在安装 MediaWiki 时显示警告:

    Warning: putenv() has been disabled for security reasons in /storage/ssd1/808/4772808/public_html/includes/Setup.php on line 129
    

    但是不影响 MediaWiki 的安装。

    安装完成后,本来应该正常显示的网站主页只出现了如下报错代码:

    Warning: putenv() has been disabled for security reasons in /storage/ssd1/808/4772808/public_html/includes/Setup.php on line 129
    
    Warning: putenv() has been disabled for security reasons in /storage/ssd1/808/4772808/public_html/includes/Setup.php on line 129
    
    Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd1/808/4772808/public_html/LocalSettings.php:1) in /storage/ssd1/808/4772808/public_html/includes/libs/HttpStatus.php on line 112
    
    Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd1/808/4772808/public_html/LocalSettings.php:1) in /storage/ssd1/808/4772808/public_html/includes/WebResponse.php on line 46
    
    Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd1/808/4772808/public_html/LocalSettings.php:1) in /storage/ssd1/808/4772808/public_html/includes/WebResponse.php on line 46
    
    Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd1/808/4772808/public_html/LocalSettings.php:1) in /storage/ssd1/808/4772808/public_html/includes/WebResponse.php on line 46
    
    Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd1/808/4772808/public_html/LocalSettings.php:1) in /storage/ssd1/808/4772808/public_html/includes/WebResponse.php on line 46
    
    Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd1/808/4772808/public_html/LocalSettings.php:1) in /storage/ssd1/808/4772808/public_html/includes/WebResponse.php on line 46
    
    Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd1/808/4772808/public_html/LocalSettings.php:1) in /storage/ssd1/808/4772808/public_html/includes/WebResponse.php on line 46
    

    楼主并非程序员,更没有 PHP 经验,只能摸索着试图解决。在网上看到有人说可以修改 PHP.ini 中“输出缓冲区数据块设置”解决,但在网站的空间内没有找到这个文件。托管商提供了 phpMyAdmin 工具,但是也并没有找到可以解决这个问题的地方,万般无奈之下只好来这里求助了,希望有人能指点迷津,不胜感激之至!

    13 条回复    2018-10-05 12:22:44 +08:00
    muzhidianzi
        1
    muzhidianzi  
       2018-10-05 04:04:02 +08:00 via Android
    也是新手 野路子出身 萌新抛砖引玉下 貌似是 PHP 安全模式? 部分函数被禁用了,需要去 php 的配置文件 php.ini 里禁用安全模式 看楼主描述貌似购买的是空间而不是 vps 或者服务器?这样应该是接触不到配置文件无法修改的。

    此外 phpmyadmin 是一个基于 php 的 web 端数据库管理程序 只是基于 php 而已

    有说错地方各位大佬斧正
    ysc3839
        2
    ysc3839  
       2018-10-05 04:04:04 +08:00 via Android
    关闭错误输出试试。一般情况下非开发环境不应该开启错误输出,以免泄漏敏感信息。
    muzhidianzi
        3
    muzhidianzi  
       2018-10-05 04:08:26 +08:00 via Android
    话说去 Google 的这个函数,居然搜到这个帖子,蜘蛛爬的真勤快
    580a388da131
        4
    580a388da131  
       2018-10-05 09:22:00 +08:00 via iPhone
    Warning: putenv() has been disabled
    它不是说了函数 putenv() 被禁用了么
    Taxila
        5
    Taxila  
    OP
       2018-10-05 10:01:45 +08:00 via Android
    @muzhidianzi 确实是空间而非服务器。查了一下确实没法改 php.ini ,但是可以改 .htaccess …
    Taxila
        6
    Taxila  
    OP
       2018-10-05 10:02:08 +08:00 via Android
    @ysc3839 关闭错误输出应该去哪里关闭呢?
    muzhidianzi
        7
    muzhidianzi  
       2018-10-05 10:39:16 +08:00 via Android
    Taxila
        8
    Taxila  
    OP
       2018-10-05 11:17:00 +08:00
    目前通过 https://www.mddhosting.com/support/knowledgebase/115/PHP---Cannot-modify-header-information---headers-already-sent-by-.html 给出的解决代码已经消除了 Warning: Cannot modify header information 警告,并且能够正常打开页面了。

    但是页面上方依然有一行 Warning: putenv() has been disabled for security reasons in /storage/ssd1/808/4772808/public_html/includes/Setup.php on line 129 即使用到了 @muzhidianzi 给的代码也没法消除,还是令人不爽。
    RiESA
        9
    RiESA  
       2018-10-05 11:22:43 +08:00
    @Taxila #8 用同样的方式关闭 display_errors 试试看?
    RiESA
        10
    RiESA  
       2018-10-05 11:32:57 +08:00
    ; display_errors
    ; Default Value: On
    ; Development Value: On
    ; Production Value: Off

    ; display_startup_errors
    ; Default Value: Off
    ; Development Value: On
    ; Production Value: Off

    ; error_reporting
    ; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
    ; Development Value: E_ALL
    ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

    ; html_errors
    ; Default Value: On
    ; Development Value: On
    ; Production value: On

    ; log_errors
    ; Default Value: Off
    ; Development Value: On
    ; Production Value: On
    RiESA
        11
    RiESA  
       2018-10-05 11:34:03 +08:00
    我之前安装的时候也遇到过,不过我是通过修改 php.ini 处理的,上面是我目前的设置,你可以参考一下
    Taxila
        12
    Taxila  
    OP
       2018-10-05 11:59:03 +08:00
    @RiESA 这里给出的代码是 php.ini 里面的吗?
    RiESA
        13
    RiESA  
       2018-10-05 12:22:44 +08:00 via Android
    @Taxila 是的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1151 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:33 · PVG 02:33 · LAX 10:33 · JFK 13:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.