dongmo1708 2012-06-06 10:20
浏览 28
已采纳

如何识别php.ini配置导致麻烦? [关闭]

I've created a custom CMS, and it works perfectly on a local server using MAMP, even if content is stored in a remote database. However, when I run it on my client's host server, shit happens.

The problem is that the CMS can't process texts which are longer than a few words. By instance, if the text is "lorem ipsum" it'll work fine, but if the text is three paragraphs long, it will display an error submitting the post.

I'm assuming this is a php.ini issue, and we have already changed php.ini memory_limit from 16M to 128M. However, the issue persists.

So my question is: does anyone know of a good way of identifying what php.ini configurations cause trouble, other than changing them one by one?

Needless to say that if I run a phpinfo() on my local server and the host server a lot of the configurations are different...

Thank you for your time and help.

[EDIT]

This edit has been rewritten as an answer ;-)

  • 写回答

1条回答 默认 最新

  • du5910 2012-06-07 08:14
    关注

    I decided to check the most common php.ini configurations that CMS like Drupal or WordPress usually demand. One of them has to do with magic_quotes_gpc.

    I found that my local server had this On and the host server had it Off, so I tried if there was an issue with that, and... there was.

    I'm ashamed to say that, but the problem had to do with a bad practice on my side. I hadn't escaped properly the data coming from the posts form. After escaping all the $_POST with mysql_real_escape_string() everything worked fine.

    Lessons learned

    1. Always escape your form's data. No exceptions.
    2. Magic quotes have been deprecated, and removed in PHP 5.4
    3. Bad practices lead to errors at some point

    I hope this will be useful to someone.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来