note 105465 added to function.fopen
| From: | merye at web-graphique dot com | Date: | Fri, 19 Aug 2011 20:10:43 +0000 |
| Subject: | note 105465 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182595@lists.php.net to get a copy of this message | ||
I had to switch from relative paths to full paths when my web host recently migrated the server onto
their hosting cloud. This used to work for me:
<?php
$fplog = fopen('ipn.log','a');
?>
After the migration, however, I received the following error message:
Warning: fopen(ipn.log) [function.fopen]: failed to open stream: Permission denied in
D:\home\server_name\log_test.php on line 21
I had to change the code to the following to get it to work:
<?php
$logfile = $_SERVER['DOCUMENT_ROOT'].'\\ipn.log';
$fplog = fopen($logfile,'a');
?>
----
Server IP: 192.41.42.26
Probable Submitter: 69.71.183.19
----
Manual Page -- http://www.php.net/manual/en/function.fopen.php
Edit -- https://master.php.net/note/edit/105465
Del: integrated -- https://master.php.net/note/delete/105465/integrated
Del: useless -- https://master.php.net/note/delete/105465/useless
Del: bad code -- https://master.php.net/note/delete/105465/bad+code
Del: spam -- https://master.php.net/note/delete/105465/spam
Del: non-english -- https://master.php.net/note/delete/105465/non-english
Del: in docs -- https://master.php.net/note/delete/105465/in+docs
Del: other reasons-- https://master.php.net/note/delete/105465
Reject -- https://master.php.net/note/reject/105465
Search -- https://master.php.net/manage/user-notes.php