You are here: PHP fails writing to text file? « PHP Programming Language « IT news, forums, messages
PHP fails writing to text file?

Posted by Gilles Ganault on 10/09/77 12:00

Hello

I'm stumped as to why PHP fails writing into a text file, with the
script being called through Apache:

==============
# pwd
/usr/local/www/data/
==============
# ll
-rwxr--r-- 1 root wheel 499 Jan 15 04:59 index.php
==============
# cat /usr/local/etc/apache/httpd.conf
User www
Group www
#BAD User root
#BAD Group wheel
==============
<?php
$fp = fopen("test.txt", "w");
fputs($fp,"First line\r\n");
fwrite($fp,"Second line\r\n");
fclose($fp);
?>
==============
http://localhost/
==============
# ll
-rwxr--r-- 1 root wheel 499 Jan 15 04:59 index.php
==============

What am I doing wrong? Is it some kind of security feature in Apache
or the OS that's preventing the script from writing the text file?

I've tried "chown www:www index.php", with no change.

Thank you.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация