ubuntu 浏览器 php,apache-PHP错误未在浏览器中显示[Ubuntu 10.10]

apache-PHP错误未在浏览器中显示[Ubuntu 10.10]

我是PHP和整个LAMP堆栈的新手,但我设法在Ubuntu 10.10系统上启动并运行它。 除了在浏览器中重新发布错误外,一切似乎都可以正常工作,而我似乎无法正常工作(并且如果没有,我将无法正常工作!)。

我已经阅读了许多文章和其他文章,这些文章指出应在文件phpinfo()中应用以下值:

phpinfo()

phpinfo()

我已经重新启动了apache2,甚至重新启动了我的计算机,但是对于我来说,我一辈子都无法正常工作。 我什至尝试使用phpinfo()函数,该函数报告这些设置与我设置的设置相同,因此我知道它正在拾取正确的配置文件,但什么也没有!

任何帮助都将受到欢迎。

12个解决方案

57 votes

不要只在php.ini文件中启用首次出现的= On。 确保向下滚动到“真实”设置,并将其从display_errors更改为Off。

事实是,如果您通过第一次出现display_errors进行更改来解决(即取消注释+添加= On),您的更改将在第480行的某处被覆盖,并再次将其设置为Off。

dbm answered 2019-11-10T23:25:08Z

43 votes

我有同样的问题-通过在两个php.ini文件中设置display_errors = On来解决。

/etc/php5/apache2/php.ini

/etc/php5/cli/php.ini

然后重新启动Apache:

sudo /etc/init.d/apache2 restart

希望这可以帮助。

Alex answered 2019-11-10T23:25:41Z

37 votes

为了使其工作,您应该在php.ini中更改以下变量:

; display_errors

; Default Value: On

; Development Value: On

; Production Value: Off

; display_startup_errors

; Default Value: On

; Development Value: On

; Production Value: Off

; error_reporting

; Default Value: E_ALL & ~E_NOTICE

; Development Value: E_ALL | E_STRICT

; Production Value: E_ALL & ~E_DEPRECATED

; html_errors

; Default Value: On

; Development Value: On

; Production value: Off

; log_errors

; Default Value: On

; Development Value: On

; Production Value: On

搜索已定义的变量,然后输入所需的值。然后重新启动您的apache2服务器,一切将正常运行。 祝好运!

sticksu answered 2019-11-10T23:26:11Z

8 votes

编辑/etc/php5/apache2/php.ini之后,请确保重新启动apache。

您可以通过运行:

sudo service apache2 restart

ChrisC answered 2019-11-10T23:26:42Z

5 votes

首先,您需要找到php.ini文件的路径

您将在指定的路径/etc/php/7.0/apache2/中找到该文件。 如果要更改CLI文件夹或CGI文件夹中的值,则将无法使用。

进行以下更改

display_errors =开

重新启动Apache服务器

/etc/init.d/apache2重新启动

Cyborg answered 2019-11-10T23:27:39Z

4 votes

如果您有覆盖本地值的本地值,则不会在php.ini中更改其值在.htaccess或虚拟主机配置文件中查找这些变量。

...

php_admin_value display_errors On

php_admin_value error_reporting E_ALL

如果您编辑虚拟主机,请重新启动apache,

$ sudo service apache2 restart

.htaccess编辑不需要apache重新启动

juanmf answered 2019-11-10T23:28:23Z

4 votes

请按照以下步骤操作,

1). Open your php.ini file via sublime through path

/etc/php/7.2/apache2/php.ini

2). find display_errors in that file

3). Un-comment these lines of code

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

4). Save the file and then type the following command in the terminal

sudo service apache2 restart

your errors are now showing in the browser

Shahrukh Anwar answered 2019-11-10T23:28:48Z

1 votes

使用display_errors = On函数在浏览器中查看设置表,并查找

配置文件(php.ini)路径

并编辑该文件。 您的计算机可以有多个php.ini文件,您想要编辑正确的文件。

还要检查该文件内的display_errors = On、html_errors = On和error_reporting = E_ALL

重新启动Apache。

Phil Rv answered 2019-11-10T23:29:39Z

0 votes

查看php.ini中的error_reporting指令。

duri answered 2019-11-10T23:30:04Z

-2 votes

当我意识到我正在使用开放短标签表单时,我只是停留在同一问题上:

echo 'nothing will be print if no open_short_tag option is enabled'; ?>

您必须转到/etc/apache2/php.ini文件并将short_open_tag = Off设置为On,然后是sudo service apache2 restart!

干杯!

cl0udw4lk3r answered 2019-11-10T23:30:38Z

-2 votes

它应该重叠,因此将其关闭。 尝试在文本编辑器中打开并找到display_errors并将其打开。 这个对我有用

Khakim Geek answered 2019-11-10T23:31:05Z

-3 votes

尝试添加log_errors = Off并检查error_reporting设置是否设置得足够高。

CodeTwice answered 2019-11-10T23:31:32Z

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值