Cannot modify header information
ปัญหา Cannot modify header information คาดว่านักพัฒนาซอฟต์แวร์ รวมถึงผู้ที่ติดตั้งซอฟต์แวร์ที่เขียนด้วย ด้วยภาษา PHP คงจะเจอกันบ่อย ซึ่งลักษณะ ข้อความแสดงการผิดพลาด มีลักษณะดังข้างล่าง
Warning: Cannot modify header information – headers already sent by
(output started at /home/somewhere/somefile.php:10) in
/home/somewhere/somefile.php on line 20
การแก้ไขปัญหา
ให้แก้ไขที่ตัวแปร output_buffering ที่อยู่ในไฟล์ php.ini โดยปกติแล้วบางระบบปฏิบัติการ จะตั้งค่าให้ output_buffering = Off ซึ่งเราสามารถแก้ไขเป็น
output_buffering = 4096
จากนั้นก็ทำการรีสตาร์ท apache เซอร์วิส ก็สามารถใช้งานได้ปกติแล้วครับ
## Ubuntu / Debian / Gentoo
# /etc/init.d/apache2 restart
# /etc/init.d/httpd restart
## FreeBSD 6.2 + Apache 2.2
# /usr/local/etc/rc.d/apache22 restart
number of view: 213











