FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Reading a file on same server
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Reading a file on same server [message #182363 is a reply to message #182362] Wed, 31 July 2013 11:40 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
On 31/07/13 12:13, Bruce Lee wrote:
> HI
>
> Suppose I have a php file "read_file.php" that is used to read .txt files, the structure of the folder/files are:
>
> /www/read_file.php
> /www/public/upload/
>
> I was wondering which will be faster and why in PHP..
>
> Method 1:
> read file using relative path
>
> Eg: get_file_contents("public/upload/test.txt");
>
>
> Method 2:
> read file using URL (note that the server which is making the request and the server where the file is being read is same)
>
> Eg: get_file_contents("http://mydomain.com/public/upload/test.txt");
>
>
> Can someone explain me which is faster and why?
>
The first one. Unless PHP is exceptionally smart the second one will invoke a recursive call to the (apache) server to deliver the file spawning another process and making and destroying a socket in the process.



> Thanks


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Why type hint when you can type cast
Next Topic: Newline (cr/lf) in imagestring
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 15:36:00 GMT 2024

Total time taken to generate the page: 0.09141 seconds