Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

does fopen() never stop trying to open a file ? (on a server

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

does fopen() never stop trying to open a file ? (on a server

Postby Usul » Mon Mar 24, 2003 11:09 am

Hi,

I use fopen() to open a *.txt file on a server. Sometimes, this server is extremely slow and then I experienced, that my site is also that slow. Doesnt fopen() have a timeout? How can I set it? Or should I use something else to open a file, like readfile() ?

So basically I want to open a file on a server and if it takes to long, then it should stop trying.

thanx
Usul
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Mar 24, 2003 11:02 am

Postby mcandrey » Tue Mar 25, 2003 4:31 am

try socket_set_timeout
mcandrey
New php-forum User
New php-forum User
 
Posts: 10
Joined: Tue Mar 25, 2003 3:59 am
Location: bucharest-romania

Postby mcandrey » Tue Mar 25, 2003 4:33 am

or:

<?php
error_reporting(E_ALL);

/* Add redirection so we can get stderr. */
$fp = popen('x.php', 'r');
echo "'$fp'; " . gettype($fp) . "\n";
$read = fread($fp, 2096);
echo $read;
pclose($fp);
?>
mcandrey
New php-forum User
New php-forum User
 
Posts: 10
Joined: Tue Mar 25, 2003 3:59 am
Location: bucharest-romania

Postby Usul » Tue Mar 25, 2003 6:28 am

thanx for posting,

can u please post an example code of how to read the content of a *.txt file on a server using fsocket() ? Im pretty newbie and I would appreciate it very much.

thanx
Usul
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Mar 24, 2003 11:02 am


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron