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

Home » Imported messages » comp.lang.php » Spaces in filenames
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Spaces in filenames [message #173704 is a reply to message #173703] Sat, 30 April 2011 11:33 Go to previous messageGo to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma:
Senior Member
In article <eli$1104300232(at)qz(dot)little-neck(dot)ny(dot)us>,
Eli the Bearded <*@eli.users.panix.com> wrote:

> In comp.lang.php, Tim Streater <timstreater(at)waitrose(dot)com> wrote:
>> When my app starts up, it discovers where it has been installed using:
>>
>> $instdir = dirname (__FILE__);
>>
>> Now, I have no control over where this might be in the file system, and
>> the user may well put it somewhere such that the path contains spaces.
>> I'm passing this round the app, and in the fullness of time may be doing
>> things like:
>>
>> $fp = fopen ($instdir . "/wiggy", "r");
>
> Why? Just chdir() and use relative filenames. You'll save yourself
> a boatload of headache.
>
> $instdir = dirname (__FILE__);
> chdir($instdir);
> $fp = fopen ("./wiggy", "r");

:-)

I didn't bother to explain how my app is structured but I see I need to.
There are in fact 47 separate PHP scripts which are run by apache for
the user. Indeed, they run on the user's machine, not on a remote host,
along with an instance of apache also run under the user's id, and some
23 html pages which request the running of the PHP scripts. Note that
I'm not using port 80 for this and the apache instance only accepts
requests from localhost.

So I could chdir, but why bother. It would just be an extra, avoidable,
bunch of PHP statements.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP Runs In WinXP Command Window But Not In Browser
Next Topic: Html code beautifier
Goto Forum:
  

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

Current Time: Fri Nov 22 21:43:48 GMT 2024

Total time taken to generate the page: 0.03795 seconds