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 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法