Connecting Tech Pros Worldwide Help | Site Map

fopen question

  #1  
Old July 17th, 2005, 05:18 AM
Xerxes
Guest
 
Posts: n/a
Hi,
I want to open a file for debugging purposes and want to know how I can
access it (write to it) from across multiple php files. I want to be
able to write debugging information from within multiple php files. Can
I store the file locally or does it have to be on the server? My php
files are a web hosting company's server.

I tried to store the file pointer returned by fopen as a session
variable. I get a warning: fopen (http://www.mydomain.com/somedir/debug)
failed to open stream: HTTP wrapper does not support writeable
connections.
Thisis followed by a bunch of:
warning: fwrite(): supplied argument is not a valid stream resource


if (!isset($_SESSION['fh'])) {
$fh = fopen("http://www.mydomain.com/somedir/debug", "w");
$_SESSION['fh'] = $fh;
}
......
......
fwrite($_SESSION['fh'], "\nsome debugging text \nmsg: ".$msg."msg_type:
".$msg_type);


Thanx.


  #2  
Old July 17th, 2005, 05:18 AM
Pedro Graca
Guest
 
Posts: n/a

re: fopen question


Xerxes wrote:[color=blue]
> I want to open a file for debugging purposes and want to know how I can
> access it (write to it) from across multiple php files. I want to be
> able to write debugging information from within multiple php files. Can
> I store the file locally or does it have to be on the server? My php
> files are a web hosting company's server.[/color]

See error_log() function.
http://www.php.net/error_log
[color=blue]
> I tried to store the file pointer returned by fopen as a session
> variable.[/color]

fopen() returns a resource. Resources are not serializable, therefore
not saved in session variables.


--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
fopen() question acorn71 answers 3 December 31st, 2005 12:05 PM
fopen() question. Longfellow answers 10 November 14th, 2005 10:21 PM
Urgent fopen question Ming answers 3 July 17th, 2005 09:24 AM
fopen question. theouimets@hotmail.com answers 3 July 17th, 2005 09:02 AM