Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3207 > unrolled thread
| Started by | Luuk <Luuk@invalid.lan> |
|---|---|
| First post | 2011-09-25 19:22 +0200 |
| Last post | 2011-09-25 14:32 -0400 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.lang.php
file_get_contents() on Windows 7 Luuk <Luuk@invalid.lan> - 2011-09-25 19:22 +0200
Re: file_get_contents() on Windows 7 Luuk <Luuk@invalid.lan> - 2011-09-25 19:35 +0200
Re: file_get_contents() on Windows 7 "Peter H. Coffin" <hellsop@ninehells.com> - 2011-09-25 12:28 -0500
Re: file_get_contents() on Windows 7 Luuk <Luuk@invalid.lan> - 2011-09-25 20:27 +0200
Re: file_get_contents() on Windows 7 Luuk <Luuk@invalid.lan> - 2011-09-25 20:39 +0200
Re: file_get_contents() on Windows 7 Doug Miller <doug_at_milmacdotcom@example.com> - 2011-09-25 14:32 -0400
| From | Luuk <Luuk@invalid.lan> |
|---|---|
| Date | 2011-09-25 19:22 +0200 |
| Subject | file_get_contents() on Windows 7 |
| Message-ID | <2k44l8-qlt.ln1@luuk.invalid.lan> |
I am getting an error when using get_file_contents,
i simplified my problem as below:
C:\TEMP>dir >test
C:\TEMP>php -e "echo get_file_contents('test', true); "
Could not open input file: echo get_file_contents(test, true);
C:\TEMP>dir test
Volume in drive C is MyCdrive
Volume Serial Number is A0B0-B175
Directory of C:\TEMP
25-09-2011 19:09 1.822 test
1 File(s) 1.822 bytes
The question is, why?
I also tried to specify full path 'c:\temp\test'
or with slashes in stead of back-slased like: 'c:/temp/test'
but no luck so far.....
--
Luuk
[toc] | [next] | [standalone]
| From | Luuk <Luuk@invalid.lan> |
|---|---|
| Date | 2011-09-25 19:35 +0200 |
| Message-ID | <1c54l8-9qt.ln1@luuk.invalid.lan> |
| In reply to | #3207 |
On 25-09-2011 19:22, Luuk wrote:
> I am getting an error when using get_file_contents,
> i simplified my problem as below:
>
> C:\TEMP>dir >test
>
> C:\TEMP>php -e "echo get_file_contents('test', true); "
> Could not open input file: echo get_file_contents(test, true);
>
> C:\TEMP>dir test
> Volume in drive C is MyCdrive
> Volume Serial Number is A0B0-B175
>
> Directory of C:\TEMP
>
> 25-09-2011 19:09 1.822 test
> 1 File(s) 1.822 bytes
>
>
> The question is, why?
>
> I also tried to specify full path 'c:\temp\test'
> or with slashes in stead of back-slased like: 'c:/temp/test'
> but no luck so far.....
>
C:\TEMP>php -v
PHP 5.3.6 (cli) (built: Mar 17 2011 10:37:07)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
(in can you want to know...)
--
Luuk
[toc] | [prev] | [next] | [standalone]
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
|---|---|
| Date | 2011-09-25 12:28 -0500 |
| Message-ID | <slrnj7up59.hbg.hellsop@nibelheim.ninehells.com> |
| In reply to | #3207 |
On Sun, 25 Sep 2011 19:22:42 +0200, Luuk wrote:
> I am getting an error when using get_file_contents,
> i simplified my problem as below:
>
> C:\TEMP>dir >test
>
> C:\TEMP>php -e "echo get_file_contents('test', true); "
> Could not open input file: echo get_file_contents(test, true);
Where is your file "echo get_file_contents('test', true); "? It is
obviously not in the current directory.
>
> C:\TEMP>dir test
> Volume in drive C is MyCdrive
> Volume Serial Number is A0B0-B175
>
> Directory of C:\TEMP
>
> 25-09-2011 19:09 1.822 test
> 1 File(s) 1.822 bytes
>
>
> The question is, why?
>
> I also tried to specify full path 'c:\temp\test'
> or with slashes in stead of back-slased like: 'c:/temp/test'
> but no luck so far.....
>
--
4. Shooting is not too good for my enemies.
--Peter Anspach's list of things to do as an Evil Overlord
[toc] | [prev] | [next] | [standalone]
| From | Luuk <Luuk@invalid.lan> |
|---|---|
| Date | 2011-09-25 20:27 +0200 |
| Message-ID | <de84l8-jtu.ln1@luuk.invalid.lan> |
| In reply to | #3209 |
On 25-09-2011 19:28, Peter H. Coffin wrote:
> On Sun, 25 Sep 2011 19:22:42 +0200, Luuk wrote:
>> I am getting an error when using get_file_contents,
>> i simplified my problem as below:
>>
>> C:\TEMP>dir>test
>>
>> C:\TEMP>php -e "echo get_file_contents('test', true); "
>> Could not open input file: echo get_file_contents(test, true);
>
> Where is your file "echo get_file_contents('test', true); "? It is
> obviously not in the current directory.
hmmmm,
too many errors on 1 line.... ;(
and its not even monday!
This works ok:
c:\TEMP>php -r "echo file_get_contents('test');"
>
>>
>> C:\TEMP>dir test
>> Volume in drive C is MyCdrive
>> Volume Serial Number is A0B0-B175
>>
>> Directory of C:\TEMP
>>
>> 25-09-2011 19:09 1.822 test
>> 1 File(s) 1.822 bytes
>>
>>
>> The question is, why?
>>
>> I also tried to specify full path 'c:\temp\test'
>> or with slashes in stead of back-slased like: 'c:/temp/test'
>> but no luck so far.....
>>
>
>
--
Luuk
[toc] | [prev] | [next] | [standalone]
| From | Luuk <Luuk@invalid.lan> |
|---|---|
| Date | 2011-09-25 20:39 +0200 |
| Message-ID | <l394l8-v3v.ln1@luuk.invalid.lan> |
| In reply to | #3210 |
On 25-09-2011 20:27, Luuk wrote:
> On 25-09-2011 19:28, Peter H. Coffin wrote:
>> On Sun, 25 Sep 2011 19:22:42 +0200, Luuk wrote:
>>> I am getting an error when using get_file_contents,
>>> i simplified my problem as below:
>>>
>>> C:\TEMP>dir>test
>>>
>>> C:\TEMP>php -e "echo get_file_contents('test', true); "
>>> Could not open input file: echo get_file_contents(test, true);
>>
>> Where is your file "echo get_file_contents('test', true); "? It is
>> obviously not in the current directory.
>
> hmmmm,
>
> too many errors on 1 line.... ;(
>
> and its not even monday!
>
> This works ok:
> c:\TEMP>php -r "echo file_get_contents('test');"
>
>>
i found the problem...
in my original code i was doing this to get the filename into $x:
$x = fgets($f);
and according to the manual the newline is included, so i had to strip
the last character of $x....
--
Luuk
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmacdotcom@example.com> |
|---|---|
| Date | 2011-09-25 14:32 -0400 |
| Message-ID | <j5ns4m$gt9$1@dont-email.me> |
| In reply to | #3207 |
On 9/25/2011 1:22 PM, Luuk wrote:
> I am getting an error when using get_file_contents,
> i simplified my problem as below:
>
> C:\TEMP>dir >test
>
> C:\TEMP>php -e "echo get_file_contents('test', true); "
> Could not open input file: echo get_file_contents(test, true);
>
[...]
> The question is, why?
Because that's not how you run PHP code from the command line.
Try using the -r flag instead.
Then you will discover that you have also misspelled the name of the
function. You have it spelled correctly in the title of your post, but
not in the PHP code shown above.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web