Home »
Imported messages »
comp.lang.php »
Reading a file on same server
Re: Reading a file on same server [message #182363 is a reply to message #182362] |
Wed, 31 July 2013 11:40 |
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.
|
|
|
Goto Forum:
Current Time: Fri Nov 22 10:43:23 GMT 2024
Total time taken to generate the page: 0.06110 seconds