doushishi6513 2014-05-22 07:16
浏览 28
已采纳

PHP MySQL错误设置

I have developed some php/mysql code on linux machine, and it runs fine. On client's machine running wamp server on windows, same operation gives a mysql error - which Php is displaying neatly in a tabular format. The error is in a mysql query with INSERT, pertaining to Duplicate Keys. (I know I can use ON DUPLICATE KEY UPDATE, but that is not the issue). Problem is, the code is supposed to handle errors gracefully.

It does on my linux machine, but on client's wamp - it displays html tables with error details. I tried try and catch around the function call, but that also does not prevent the error from getting displayed in the browser (the PHP file is supposed to emit json data for ajax calls, that is why I cannot afford to have those error display by PHP).

Also, in the php file, I have

ini_set('display_errors', 1); error_reporting(E_ALL);

and still, since its a mysql error, it rightly does not throw any php error on linux, but does on windows.

So basically, I want to know what PHP setting (or something else?) on client's machine could be causing the MySQL error to be propagated / processed by PHP, and how to turn it off.

Thanks

  • 写回答

4条回答 默认 最新

  • doupuzhimuhan9216 2014-05-22 07:59
    关注

    You might want to check your php.ini and look at these values:

    xdebug.auto_trace=1
    xdebug.trace_format=1
    mysql.trace_mode = On
    pdo_mysql.debug = On
    

    If they are there, disable them

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 Marscode IDE 如何预览新建的 HTML 文件
  • ¥15 K8S部署二进制集群过程中calico一直报错
  • ¥15 java python或者任何一种编程语言复刻一个网页
  • ¥20 如何通过代码传输视频到亚马逊平台
  • ¥15 php查询mysql数据库并显示至下拉列表中
  • ¥15 freertos下使用外部中断失效
  • ¥15 输入的char字符转为int类型,不是对应的ascall码,如何才能使之转换为对应ascall码?或者使输入的char字符可以正常与其他字符比较?
  • ¥15 devserver配置完 启动服务 无法访问static上的资源
  • ¥15 解决websocket跟c#客户端通信
  • ¥30 Python调用dll文件输出Nan重置dll状态