[PHP] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Jon Westcot
Hi all:

I'm working on a project that requires frequent updating of a large amount 
of data to a MySQL database.  Currently, I'm trying to transfer a CSV file to 
the server, have it process the file, and then delete it once the processing is 
complete.  Rather than waste the up-front time of having to upload the file 
(which is currently timing out without fully uploading the file and I have no 
idea how to resolve this!), is it possible to have the server open the 
specified file remotely and read it using the fgetcsv() function?  If so, how?

Any help you can give me will be GREATLY appreciated!

Thanks,

Jon


Re: [PHP] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Andrew Ballard
How big is the file? fgetcsv() will read any file that you can get a
handle to using fopen() or fsockopen(),  including remote files.
However, if allow_url_fopen is not enabled, you can't use fopen().
Also if the file is so large that your script is timing out while
waiting for it to be uploaded, it could also timeout just trying to
read the file remotely as well.

Andrew

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



Re: [PHP] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Wolf
Go into your php.ini file and increase the script timeout length, which should 
allow the upload to finish.


 Jon Westcot [EMAIL PROTECTED] wrote: 
 Hi all:
 
 I'm working on a project that requires frequent updating of a large 
 amount of data to a MySQL database.  Currently, I'm trying to transfer a CSV 
 file to the server, have it process the file, and then delete it once the 
 processing is complete.  Rather than waste the up-front time of having to 
 upload the file (which is currently timing out without fully uploading the 
 file and I have no idea how to resolve this!), is it possible to have the 
 server open the specified file remotely and read it using the fgetcsv() 
 function?  If so, how?
 
 Any help you can give me will be GREATLY appreciated!
 
 Thanks,
 
 Jon

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



Re: [PHP] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Jon Westcot
Thanks, Wolf.  I'm going to have to do a lot of long processes -- uploads,
queries, and the like -- and I appreciate knowing that I can adjust that.
Now if I can just find the PHP.INI file  (Stupid GoDaddy-shared-domains;
can't find anything on 'em.)

Jon

- Original Message -
From: Wolf [EMAIL PROTECTED]
To: Jon Westcot [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Wednesday, October 24, 2007 1:16 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


 Go into your php.ini file and increase the script timeout length, which
should allow the upload to finish.


  Jon Westcot [EMAIL PROTECTED] wrote:
  Hi all:
 
  I'm working on a project that requires frequent updating of a large
amount of data to a MySQL database.  Currently, I'm trying to transfer a CSV
file to the server, have it process the file, and then delete it once the
processing is complete.  Rather than waste the up-front time of having to
upload the file (which is currently timing out without fully uploading the
file and I have no idea how to resolve this!), is it possible to have the
server open the specified file remotely and read it using the fgetcsv()
function?  If so, how?
 
  Any help you can give me will be GREATLY appreciated!
 
  Thanks,
 
  Jon

 --
 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] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Jon Westcot
Hi Andrew:

Thanks for the reply.

If I use fopen() to open the remote file, how do I specify its location?
Isn't it going to need to know not only the address of the computer I'm
using but the path on that computer to the file?  Does it get all that from
the name I pass over to it?

Also, can I adjust the allow_url_fopen setting from within a PHP script,
or do I need to manually set it in the PHP.INI file?  The server I'm
using -- not my own; this is for a friend -- is a shared server with GoDaddy
and they make it so incredibly hard to find anything.

Thanks!

Jon


- Original Message -
From: Andrew Ballard [EMAIL PROTECTED]
To: PHP General php-general@lists.php.net
Sent: Wednesday, October 24, 2007 1:15 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


 How big is the file? fgetcsv() will read any file that you can get a
 handle to using fopen() or fsockopen(),  including remote files.
 However, if allow_url_fopen is not enabled, you can't use fopen().
 Also if the file is so large that your script is timing out while
 waiting for it to be uploaded, it could also timeout just trying to
 read the file remotely as well.

 Andrew

 --
 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] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Vo, Lance
you probably won't be able to edit PHP.ini with shared-hosting. The other 
solutions, one I can think of it now - you can use PHP to upload files from 
remote computer to the server at certain time, and set schedule with cron to 
run your PHP scripts on your server. 
Good luck

-Original Message-
From: Jon Westcot [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 24, 2007 3:18 PM
To: PHP General
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


Thanks, Wolf.  I'm going to have to do a lot of long processes -- uploads,
queries, and the like -- and I appreciate knowing that I can adjust that.
Now if I can just find the PHP.INI file  (Stupid GoDaddy-shared-domains;
can't find anything on 'em.)

Jon

- Original Message -
From: Wolf [EMAIL PROTECTED]
To: Jon Westcot [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Wednesday, October 24, 2007 1:16 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


 Go into your php.ini file and increase the script timeout length, which
should allow the upload to finish.


  Jon Westcot [EMAIL PROTECTED] wrote:
  Hi all:
 
  I'm working on a project that requires frequent updating of a large
amount of data to a MySQL database.  Currently, I'm trying to transfer a CSV
file to the server, have it process the file, and then delete it once the
processing is complete.  Rather than waste the up-front time of having to
upload the file (which is currently timing out without fully uploading the
file and I have no idea how to resolve this!), is it possible to have the
server open the specified file remotely and read it using the fgetcsv()
function?  If so, how?
 
  Any help you can give me will be GREATLY appreciated!
 
  Thanks,
 
  Jon

 --
 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] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Jon Westcot
Hi again, Andrew:

You had asked some questions that I forgot to address with my previous
reply, so here goes:

The test file that I'm using -- which probably is a small version of the
normal file -- is around 60 MB in size (just under 30,000 records).

I checked the phpinfo info and it appears that the allow_url_fopen
setting is set to On, which I take is a good thing.  How, then, do I
specify the filename at the server so that it points back to the file that
is on my computer (or whatever computer is trying to initiate the process)?

Thanks again for your help,

Jon


- Original Message -
From: Jon Westcot [EMAIL PROTECTED]
To: PHP General php-general@lists.php.net
Sent: Wednesday, October 24, 2007 1:22 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


 Hi Andrew:

 Thanks for the reply.

 If I use fopen() to open the remote file, how do I specify its
location?
 Isn't it going to need to know not only the address of the computer I'm
 using but the path on that computer to the file?  Does it get all that
from
 the name I pass over to it?

 Also, can I adjust the allow_url_fopen setting from within a PHP
script,
 or do I need to manually set it in the PHP.INI file?  The server I'm
 using -- not my own; this is for a friend -- is a shared server with
GoDaddy
 and they make it so incredibly hard to find anything.

 Thanks!

 Jon


 - Original Message -
 From: Andrew Ballard [EMAIL PROTECTED]
 To: PHP General php-general@lists.php.net
 Sent: Wednesday, October 24, 2007 1:15 PM
 Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


  How big is the file? fgetcsv() will read any file that you can get a
  handle to using fopen() or fsockopen(),  including remote files.
  However, if allow_url_fopen is not enabled, you can't use fopen().
  Also if the file is so large that your script is timing out while
  waiting for it to be uploaded, it could also timeout just trying to
  read the file remotely as well.
 
  Andrew
 
  --
  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



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



Re: [PHP] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Andrew Ballard
On 10/24/07, Jon Westcot [EMAIL PROTECTED] wrote:
 The test file that I'm using -- which probably is a small version of the
 normal file -- is around 60 MB in size (just under 30,000 records).

That sounds like a rather large file to process anyway. You might need
to use some scheduled task like Lance suggested to copy the file and
then open it locally. I'm not sure how GoDaddy hosting works.

 I checked the phpinfo info and it appears that the allow_url_fopen
 setting is set to On, which I take is a good thing.

It's pretty typical, but you never know without checking since it is an option.

  How, then, do I
 specify the filename at the server so that it points back to the file that
 is on my computer (or whatever computer is trying to initiate the process)?

The file has to be accessible from the server through either a web
path or some sort of file share or local file path. So if the server
can see the file as http://remoteserver/remotefile.csv,
\\remoteserver\remotefile.csv, etc., you can use that path.

Andrew

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



Re: [PHP] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Edward Vermillion
There is set_time_limit() that works from the script as long as  
safe_mode is not enabled.


http://docs.php.net/manual/en/function.set-time-limit.php

Ed


On Oct 24, 2007, at 3:26 PM, Vo, Lance wrote:

you probably won't be able to edit PHP.ini with shared-hosting. The  
other solutions, one I can think of it now - you can use PHP to  
upload files from remote computer to the server at certain time,  
and set schedule with cron to run your PHP scripts on your server.

Good luck

-Original Message-
From: Jon Westcot [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 24, 2007 3:18 PM
To: PHP General
Subject: Re: [PHP] Can a PHP script process a file on a remote  
computer?



Thanks, Wolf.  I'm going to have to do a lot of long processes --  
uploads,
queries, and the like -- and I appreciate knowing that I can adjust  
that.
Now if I can just find the PHP.INI file  (Stupid GoDaddy-shared- 
domains;

can't find anything on 'em.)

Jon

- Original Message -
From: Wolf [EMAIL PROTECTED]
To: Jon Westcot [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Wednesday, October 24, 2007 1:16 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote  
computer?



Go into your php.ini file and increase the script timeout length,  
which

should allow the upload to finish.



 Jon Westcot [EMAIL PROTECTED] wrote:

Hi all:

I'm working on a project that requires frequent updating of a  
large
amount of data to a MySQL database.  Currently, I'm trying to  
transfer a CSV
file to the server, have it process the file, and then delete it  
once the
processing is complete.  Rather than waste the up-front time of  
having to
upload the file (which is currently timing out without fully  
uploading the
file and I have no idea how to resolve this!), is it possible to  
have the
server open the specified file remotely and read it using the  
fgetcsv()

function?  If so, how?


Any help you can give me will be GREATLY appreciated!

Thanks,

Jon


--
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



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