douzuqin3467 2016-03-18 08:59
浏览 260

我可以在Linux(Debian)中为各个文件夹设置php.ini吗?

I'm new to PHP and server configuration in general, so I apologize in advance if this is a stupid question. Basically I have LAMP on my laptop (I installed Debian, Apache, MySQL, PHP separately, not as a bundle). The websites on my localhost are located in var/www/html/. I made a subfolder called 'php' (var/www/html/php/) where I'm learning and experimenting with PHP code.

Now, I made a php.ini file in var/www/html/php/ which only contains 2 lines:

display_errors = on
display_startup_errors = on

All I want is for the errors to display so that I know what I'm doing wrong. Anyway, that didn't work. So I moved the php.ini file to var/www/html/ but it still didn't work. In the end I had to go to the folder where PHP is installed and edit the php.ini file there (i.e. /etc/php5/apache2/php.ini).

I can see the errors now, but what if I don't want to turn on display_errors for every site in my localhost? What if I want to have display_errors=On for some folders and display_errors=off for some folders? How do I do that?

  • 写回答

1条回答 默认 最新

  • duanliangman5398 2016-03-18 10:44
    关注

    You can use the .htaccess php_value mechanism to modify php values.

    For instance, having

    php_value display_errors on
    

    On your .htaccess will set this value for every file in that folders and every descending folders.

    More informations here: https://secure.php.net/manual/en/configuration.changes.php

    评论

报告相同问题?

悬赏问题

  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题