RE: [PHP] fopen problem

2005-06-24 Thread Shaw, Chris - Accenture

Are you using the a or a+ modes on fopen, because I have a sneaky feeling the
file doesn't exist.

-Original Message-
From: Ross [mailto:[EMAIL PROTECTED]
Sent: 24 June 2005 00:33
To: php-general@lists.php.net
Subject: [PHP] fopen problem


*

This e-mail has been received by the Revenue Internet e-mail service.

*

I have a bit of a problem when using fopen, fwrite and fclose locally I get
the flowing warnings

Warning: fopen(counterlog.txt) [function.fopen]: failed to open stream:
Permission denied in c:\Inetpub\wwwroot\pillars\index.php on line 30

Warning: fwrite(): supplied argument is not a valid stream resource in
c:\Inetpub\wwwroot\pillars\index.php on line 33

Warning: fclose(): supplied argument is not a valid stream resource in
c:\Inetpub\wwwroot\pillars\index.php on line 36


Any ideas??


R.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] fopen problem

2005-06-23 Thread Ross
I have a bit of a problem when using fopen, fwrite and fclose locally I get 
the flowing warnings

Warning: fopen(counterlog.txt) [function.fopen]: failed to open stream: 
Permission denied in c:\Inetpub\wwwroot\pillars\index.php on line 30

Warning: fwrite(): supplied argument is not a valid stream resource in 
c:\Inetpub\wwwroot\pillars\index.php on line 33

Warning: fclose(): supplied argument is not a valid stream resource in 
c:\Inetpub\wwwroot\pillars\index.php on line 36


Any ideas??


R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fopen problem

2005-06-23 Thread Esteamedpw
can you show the code? did you chmod the files?


Re: [PHP] fopen problem

2005-06-23 Thread Richard Lynch
On Thu, June 23, 2005 4:33 pm, Ross said:
 Warning: fopen(counterlog.txt) [function.fopen]: failed to open stream:
 Permission denied in c:\Inetpub\wwwroot\pillars\index.php on line 30

The PHP user does *NOT* have permission to open the counterlog.txt file.

Exactly *HOW* you change permissions changed in every Windoze version,
which suck, but there it is.

You should A) post *which* Windows OS you are using and B) try the Windows
list and C) poke around with Windows Explorer first to see if you can't
make the counterlog.txt file be owned by the User PHP is running as, which
you can find out from http://php.net/phpinfo

Actually, do ABC) in reverse order :-)

 Warning: fwrite(): supplied argument is not a valid stream resource in
 c:\Inetpub\wwwroot\pillars\index.php on line 33

 Warning: fclose(): supplied argument is not a valid stream resource in
 c:\Inetpub\wwwroot\pillars\index.php on line 36

These are a direct result of the first error.

Your script should NOT have even *TRIED* to run these functions, once it
failed to open the file in the first place.

Add a lot more error-checking to your script.

Once you fix the first error, these errors will go away

In Reality, they are just waiting to re-surface when something else goes
wrong with your file access.

So, actually, fix your script to skip these lines *FIRST* then fix the
error above.  Consider it part of the learning to write Good Code.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] fopen problem using ftp

2005-02-15 Thread Giulio
HI all,
I have a script that uses fopen to acces for read a file using ftp:
$filepointer = fopen($address,'r');
having $address string formed this way:
$address =  
ftp:/ 
/.$FTPuser.:.$FTPpassword.@.$FTPserver./.$FileFolder./.$FileNa 
me;

This script always worked for me, it has now stopped working trying it  
on the server of a different provider, returning an error 'failed to  
open stream...'

I have the suspect that the funcion is failing due to the particular  
account name ( used also as FTP username ) this italian provider gived  
me when I sibscribed: It contains a @ symbol ( I.E., [EMAIL PROTECTED] ),  
 and I believe that this confuses the parsing of the  
ftp://User:[EMAIL PROTECTED]/filepath string.

Can you confirm this, or do you believe that the problem could be  
caused by other factors ( like server settings ) ?

Could you suggest me e workaround?
 Thank you,
  Giulio
Cantoberon Multimedia srl
http://www.cantoberon.it
Tel. 06 39737052

Re: [PHP] fopen problem using ftp

2005-02-15 Thread Richard Lynch
Giulio wrote:
 HI all,

 I have a script that uses fopen to acces for read a file using ftp:

 $filepointer = fopen($address,'r');

 having $address string formed this way:

 $address =
 ftp:/
 /.$FTPuser.:.$FTPpassword.@.$FTPserver./.$FileFolder./.$FileNa
 me;

You really don't need all those '.' in there:P

$address = ftp://$FTPuser:[EMAIL PROTECTED]/$FileFolder/$FileName;

will work just fine.

Not any faster or anything, just more readable.

 This script always worked for me, it has now stopped working trying it
 on the server of a different provider, returning an error 'failed to
 open stream...'

 I have the suspect that the funcion is failing due to the particular
 account name ( used also as FTP username ) this italian provider gived
 me when I sibscribed: It contains a @ symbol ( I.E., [EMAIL PROTECTED] ),
   and I believe that this confuses the parsing of the
 ftp://User:[EMAIL PROTECTED]/filepath string.

 Can you confirm this, or do you believe that the problem could be
 caused by other factors ( like server settings ) ?

 Could you suggest me e workaround?

Try using just the 123456 of the username...  Probably won't work, but
worth a shot.

Or do this:
$FTPuserURL = urlencode($FTPuser);
before you compose the $address, and use $FTPuserURL instead of $FTPuser.

That will replace the @ with %40 which will almost for sure be the kosher
way have @ in an FTP username in a URL.

Technically, you could/should also urlencode() the password and FilePath
and FileName, I think.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fopen problem using ftp

2005-02-15 Thread The Disguised Jedi
Why not use the built in FTP functions instead of fopen?

us2.php.net/ftp

Those should be able to handle any of the address problems you have,
seeing as they don't use the ftp://username:[EMAIL PROTECTED] syntax,
they open a connection and work with the FTP system.


-- 
The Disguised Jedi
[EMAIL PROTECTED]

Now you have my $0.02.  Or .01 Pounds, .014 Euros, or $0.025 CAN.  I'm
already internationally compatible!
PHP rocks!
Knowledge is Power.  Power Corrupts.  Go to school, become evil

Disclaimer: Any disclaimer attached to this message may be ignored. 
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fopen problem, 5 line script

2004-09-16 Thread Chris Dowell
Irrelevant, Warren
Mag,
the point is that you're trying to use a function (filesize) that uses 
the stat() system call. This function is not supported using the http 
wrapper to fopen (because HTTP doesn't support it at all)

So regardless of whether you should be using the file name or the handle 
(it's the name, btw), the call will fail because you're trying to stat() 
a file which isn't supported.

Thus filesize() is failing (with a warning), and fread() is then failing 
because filesize() returns false, which evaluates to 0.

Hope this has made things clearer, if not, a quick check of the manual 
entries for stat, filesize and Appendix L 
(http://uk.php.net/manual/en/wrappers.php) may help

Cheers
chris
Vail, Warren wrote:
I thought filesize required the file name, and not the fileptr???
Warren Vail
-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 15, 2004 10:17 AM
To: php php
Subject: Re: [PHP] fopen problem, 5 line script

* Thus wrote Mag:
 

Hi,
Can someone tell me what I am doing wrong here please?
?php
$fileptr =
fopen(http://www.google.com/index.html,r;);
$contents = fread($fileptr, filesize($fileptr));
...
This is the error I get:
Warning: filesize(): Stat failed for Resource id #1
(errno=2 - No such file or directory) in 
/home/quickxxx/public_html/tpg/ check- remote.php on line 4

Warning: fread(): Length parameter must be greater
than 0. in /
home/quickxxx/public_html/tpg/check-remote.php on line
   

filesize() relies on the fact that the file you opened has support for
stat(). the http wrapper does not have such a thing.
see:
 http://php.net/filesize
 http://php.net/wrappers.http
Curt
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] fopen problem, 5 line script

2004-09-15 Thread Mag
Hi,
Can someone tell me what I am doing wrong here please?

?php
$fileptr =
fopen(http://www.google.com/index.html,r;);

$contents = fread($fileptr, filesize($fileptr));

if(strstr($contents,
href=\/froogle?hl=entab=wf\))
{ $result = 1;}else{ $result = 2;}

echo $result;
?

This is the error I get:
Warning: filesize(): Stat failed for Resource id #1
(errno=2 - No such file or directory) in
/home/quickxxx/public_html/tpg/ check- remote.php on
line 4

Warning: fread(): Length parameter must be greater
than 0. in /
home/quickxxx/public_html/tpg/check-remote.php on line
4
2



Any ideas?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fopen problem, 5 line script

2004-09-15 Thread Mark

--- Mag [EMAIL PROTECTED] wrote:

 Hi,
 Can someone tell me what I am doing wrong here please?
 
 ?php
 $fileptr =
 fopen(http://www.google.com/index.html,r;);
 
 $contents = fread($fileptr, filesize($fileptr));

http://us2.php.net/filesize
int filesize ( string filename)


 
 if(strstr($contents,
 href=\/froogle?hl=entab=wf\))
 { $result = 1;}else{ $result = 2;}
 
 echo $result;
 ?
 
 This is the error I get:
 Warning: filesize(): Stat failed for Resource id #1
 (errno=2 - No such file or directory) in
 /home/quickxxx/public_html/tpg/ check- remote.php on
 line 4
 
 Warning: fread(): Length parameter must be greater
 than 0. in /
 home/quickxxx/public_html/tpg/check-remote.php on line
 4
 2
 
 
 
 Any ideas?
 
 Thanks,
 Mag
 
 =
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 
   
 __
 Do you Yahoo!?
 Yahoo! Mail - 50x more storage than other providers!
 http://promotions.yahoo.com/new_mail
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***



__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fopen problem, 5 line script

2004-09-15 Thread Curt Zirzow
* Thus wrote Mag:
 Hi,
 Can someone tell me what I am doing wrong here please?
 
 ?php
 $fileptr =
 fopen(http://www.google.com/index.html,r;);
 
 $contents = fread($fileptr, filesize($fileptr));
...
 
 This is the error I get:
 Warning: filesize(): Stat failed for Resource id #1
 (errno=2 - No such file or directory) in
 /home/quickxxx/public_html/tpg/ check- remote.php on
 line 4
 
 Warning: fread(): Length parameter must be greater
 than 0. in /
 home/quickxxx/public_html/tpg/check-remote.php on line

filesize() relies on the fact that the file you opened has support
for stat(). the http wrapper does not have such a thing.

see:
  http://php.net/filesize
  http://php.net/wrappers.http


Curt
-- 
The above comments may offend you. flame at will.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] fopen problem, 5 line script

2004-09-15 Thread Vail, Warren
I thought filesize required the file name, and not the fileptr???

Warren Vail


-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 15, 2004 10:17 AM
To: php php
Subject: Re: [PHP] fopen problem, 5 line script


* Thus wrote Mag:
 Hi,
 Can someone tell me what I am doing wrong here please?
 
 ?php
 $fileptr =
 fopen(http://www.google.com/index.html,r;);
 
 $contents = fread($fileptr, filesize($fileptr));
...
 
 This is the error I get:
 Warning: filesize(): Stat failed for Resource id #1
 (errno=2 - No such file or directory) in 
 /home/quickxxx/public_html/tpg/ check- remote.php on line 4
 
 Warning: fread(): Length parameter must be greater
 than 0. in /
 home/quickxxx/public_html/tpg/check-remote.php on line

filesize() relies on the fact that the file you opened has support for
stat(). the http wrapper does not have such a thing.

see:
  http://php.net/filesize
  http://php.net/wrappers.http


Curt
-- 
The above comments may offend you. flame at will.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fopen problem, 5 line script

2004-09-15 Thread Mag

--- Curt Zirzow [EMAIL PROTECTED] wrote:

 * Thus wrote Mag:
  Hi,
  Can someone tell me what I am doing wrong here
 please?
  
  ?php
  $fileptr =
  fopen(http://www.google.com/index.html,r;);
  
  $contents = fread($fileptr, filesize($fileptr));
 ...
  
  This is the error I get:
  Warning: filesize(): Stat failed for Resource id
 #1
  (errno=2 - No such file or directory) in
  /home/quickxxx/public_html/tpg/ check- remote.php
 on
  line 4
  
  Warning: fread(): Length parameter must be greater
  than 0. in /
  home/quickxxx/public_html/tpg/check-remote.php on
 line
 
 filesize() relies on the fact that the file you
 opened has support
 for stat(). the http wrapper does not have such a
 thing.
 
 see:
   http://php.net/filesize
   http://php.net/wrappers.http
 
 


Thanks for your replies guys but you have left me even
more confused...can someone correct my 5 line script
and tell me what was wrong THEN give me the php.net
manual urls? like this am just getting more
confused...

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fopen problem, 5 line script [SOLVED!]

2004-09-15 Thread Mag
Got it,
'case anybody else needs this:

$page =
file_get_contents('http://www.google.se/index.html');
if(strstr($page,
'href=/imghp?hl=svtab=wiie=UTF-8'))
{
  $resultt = 1;
}
else
{
  $resultt = 2;
}

echo $resultt;

Cheers,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] fopen problem

2003-02-08 Thread Jeff Schwartz

I'm having trouble with a basic file write and can't figure out why. 

 

It must have something to do with the program the code is in because if I run that 
same code as a separate program, as the same user, and on the same directory, it works 
fine.

 

The program is listening on a port with:

 

$fp0 = fopen(php://stdin,r); 
while (!feof($fp0)){

and writing to stdout, successfully, using:

   $fp1 = fopen(php://stdout,w); 
   fputs($fp1,$response.\r\n);
   fclose($fp1);


But, the file open is failing. Is there any way to get more detail on why fopen is 
failing? Or, any ideas what could be going on in the rest of my program that could 
affect this?

Thanks,

 



if ($fp = fopen($body_file,w)):

fputs($fp,$body,strlen($body));

@fclose($fp);

else:

echo Failed;

endif;



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


[PHP] fopen problem... maybe?

2001-02-20 Thread Ben Weinberger

Hi~
We're working on a page located at 
http://www.manageasy.com/request_offer.php3. The page comes up with a bunch 
of errors, and we don't know why-- the page worked on our old server, and 
we didn't change anything from there... we think it might be a permissions 
issue on the new server.  Does anyone have any ideas off hand?

Thanks,
-Ben


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fopen problem... maybe?

2001-02-20 Thread David Robley

On Wed, 21 Feb 2001 15:23, Ben Weinberger wrote:
 Hi~
 We're working on a page located at
 http://www.manageasy.com/request_offer.php3. The page comes up with a
 bunch of errors, and we don't know why-- the page worked on our old
 server, and we didn't change anything from there... we think it might
 be a permissions issue on the new server.  Does anyone have any ideas
 off hand?

 Thanks,
 -Ben

Somebody else had a similar problem recently and the broad outcome was 
that the script is trying to access parts of a mysql result set that 
doesn't exist. Check the recent archives for more detail.

Cheers
-- 
David Robley| WEBMASTER  Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet| http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]