To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > Windows Help

Windows Help Help with the Windows operating system

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-31-2000, 12:41 PM   #1
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
Current Directory...

I tried this with PHP on Linux, and it worked.

<?
$current_dir = exec("cd") ;
echo "The current directory is [$current_dir] " ;

?>
On Windows, all this returns is:

The current directory is [

Note the lack of the closing bracket...
There isn't any suspicious in the Apache log files.
I'm wondering why this won't work.

I'm using PHP 3, and Apache 1.3.12 on a windows 98 box.

This is going to be a file management piece, eventually.
Anon is offline   Reply With Quote
Old 07-31-2000, 01:24 PM   #2
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: Current Directory...-Plot thickens

It turns out that the results are being displayed on the Apache console.
It's just not getting stored into the variable.

Being that, I tried:

The current directory is

<?
system("cd") ;
?>

And that didn't return anything to the browser, but it displayed the results to the console screen.

-Help?
Anon is offline   Reply With Quote
Old 07-31-2000, 01:34 PM   #3
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: Current Directory...

This should work on both unix and NT

$basename = basename($PATH_TRANSLATED);
$current_dir = ereg_replace("$basename", "", $PATH_TRANSLATED);
print $current_dir;
Anon is offline   Reply With Quote
Old 07-31-2000, 02:05 PM   #4
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: Current Directory...

It worked, thank you. Could you tell me why the original snippet i posted didn't work?

Thanks again.
-Lysa
Anon is offline   Reply With Quote
Old 08-01-2000, 01:21 AM   #5
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: Current Directory...

I am not really sure why it doesn't work. But I have a feeling that the way php interacts with the server may vary between unix and NT.
Anon is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 08:41 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.