473,807 Members | 2,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with chdir()

I have a script that uses the chdir() function. I know the script works (
works perfectly on my host ), but when I put the script on my server here at
work I get the following error.

Warning: chdir(): No such file or directory (errno 2)

The same script works at my personal host, thats the part that bothers me.
The host here at work is running PHP 4.3.8. Any suggestions about how to get
this to work? or maybe another function that does the same thing as chdir().

Nick


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #1
5 4000
Nicholas Geraldi wrote:
I have a script that uses the chdir() function. I know the script works (
works perfectly on my host ), but when I put the script on my server here at
work I get the following error.

Warning: chdir(): No such file or directory (errno 2)

The same script works at my personal host, thats the part that bothers me.
The host here at work is running PHP 4.3.8. Any suggestions about how to get
this to work? or maybe another function that does the same thing as chdir().


Maybe the directory youre trying to chdir() exists on your personal
computer, but does not exists on your server. Thats basically what that
error message says, anyways.
Jul 17 '05 #2

"eXeonical" <sp******@mbnet .fi> wrote in message
news:cd******** **@plaza.suomi. net...
Nicholas Geraldi wrote:
I have a script that uses the chdir() function. I know the script works ( works perfectly on my host ), but when I put the script on my server here at work I get the following error.

Warning: chdir(): No such file or directory (errno 2)

The same script works at my personal host, thats the part that bothers me. The host here at work is running PHP 4.3.8. Any suggestions about how to get this to work? or maybe another function that does the same thing as
chdir().
Maybe the directory youre trying to chdir() exists on your personal
computer, but does not exists on your server. Thats basically what that
error message says, anyways.


Im using readdir() to get a list of directories(and is_dir() to test to be
sure) to change to, it should be able to work in any file system that
supports chdir(). Both Home and work are using Linux ( Red Hat at home and
Fidora(sp?) at Work ). But for some reason its not working at Work.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #3
On Fri, 23 Jul 2004 14:13:41 -0400, "Nicholas Geraldi"
<ni*********@ta conic.net> wrote:

"eXeonical" <sp******@mbnet .fi> wrote in message
news:cd******* ***@plaza.suomi .net...
Nicholas Geraldi wrote:
> I have a script that uses the chdir() function. I know the script works( > works perfectly on my host ), but when I put the script on my serverhere at > work I get the following error.
>
> Warning: chdir(): No such file or directory (errno 2)
>
> The same script works at my personal host, thats the part that bothersme. > The host here at work is running PHP 4.3.8. Any suggestions about how toget > this to work? or maybe another function that does the same thing as

chdir().

Maybe the directory youre trying to chdir() exists on your personal
computer, but does not exists on your server. Thats basically what that
error message says, anyways.


Im using readdir() to get a list of directories(and is_dir() to test to be
sure) to change to, it should be able to work in any file system that
supports chdir(). Both Home and work are using Linux ( Red Hat at home and
Fidora(sp?) at Work ). But for some reason its not working at Work.


Post some code; a minimal example that demonstrates the problem, preferably
with a couple of examples from 'ls -l' to show what it's supposed to be
reading.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #4

"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:9t******** *************** *********@4ax.c om...
On Fri, 23 Jul 2004 14:13:41 -0400, "Nicholas Geraldi"
<ni*********@ta conic.net> wrote:

"eXeonical" <sp******@mbnet .fi> wrote in message
news:cd******* ***@plaza.suomi .net...
Nicholas Geraldi wrote:

> I have a script that uses the chdir() function. I know the script
works(
> works perfectly on my host ), but when I put the script on my serverhere at
> work I get the following error.
>
> Warning: chdir(): No such file or directory (errno 2)
>
> The same script works at my personal host, thats the part that
bothersme.
> The host here at work is running PHP 4.3.8. Any suggestions about how
toget
> this to work? or maybe another function that does the same thing as

chdir().

Maybe the directory youre trying to chdir() exists on your personal
computer, but does not exists on your server. Thats basically what that
error message says, anyways.


Im using readdir() to get a list of directories(and is_dir() to test to besure) to change to, it should be able to work in any file system that
supports chdir(). Both Home and work are using Linux ( Red Hat at home andFidora(sp?) at Work ). But for some reason its not working at Work.


Post some code; a minimal example that demonstrates the problem,

preferably with a couple of examples from 'ls -l' to show what it's supposed to be
reading.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

The code i am using is this...

<?PHP

function get_protect_dir (){
return array("pictures ");
}

function get_dir($dir){
$testing = chdir($dir);
$protected_dir = get_protect_dir ();
$directory = '';
$j = 0;

$dh = opendir('.');
while ($filename = readdir($dh)){
$dontcount = 0;
if((!is_file($f ilename)) && ($filename != '.') && ($filename != '..') &&
(is_dir($filena me))){
foreach($protec ted_dir as $temp_dir){
if($filename == $temp_dir){
$dontcount = 1;
}
}
if($dontcount != 1){
$directory[$j] = $filename;
$j++;
}
}
}
closedir($dh);
return $directory;
}

function rec_dir($dir){
$dir_array = get_dir($dir);
$recurve_dir = '';

echo "<CENTER><T ABLE SPAN=\"90%\" CELLSPACING=1 CELLPADDING=10> ";
$counter = 1;
foreach($dir_ar ray as $temp_dir){
if(($counter%2) != 0){
echo "<TR>";
}
echo "<TD><TABLE CELLSPACING=0 CELLPADDING=0>< TR>";
echo "<TD><FONT SIZE=4><U>$temp _dir</U></FONT></TD></TR>";

$recurve_dir = get_dir($temp_d ir);
echo "<TR><TD><F ONT SIZE=2>";
if($recurve_dir != 0){
foreach($recurv e_dir as $temp2_dir){
echo "<U>$temp2_ dir</U>,";
}
}
echo "</FONT></TD></TR>";
echo "</TABLE></TD>";
if(($counter%2) == 0){
echo "</TR>";
}
$counter++;

}

echo "</TR></TD></TABLE></CENTER>";
}

echo "<HTML>";
echo "<BODY>";
rec_dir('.');

echo "</BODY>";
echo "</HTML>";
?>

the directory structure is very simple.

/test
/test/dir_function.ph p [name of that file]
/test/test2
/test/test2/test21
/test/test2/test22

At home it gives me test just like its supposed too. at work it reads the
top level (test2 in this case) but then gives errors when it tries to
chdir() into test2 to get test21 and test22.

( you should be able to copy and paste that code exactly )

Thanks for the help,
Nick


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #5

"Nicholas Geraldi" <ni*********@ta conic.net> wrote in message
news:41******** @corp.newsgroup s.com...
I have a script that uses the chdir() function. I know the script works (
works perfectly on my host ), but when I put the script on my server here at work I get the following error.

Warning: chdir(): No such file or directory (errno 2)

The same script works at my personal host, thats the part that bothers me.
The host here at work is running PHP 4.3.8. Any suggestions about how to get this to work? or maybe another function that does the same thing as chdir().
Nick


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


I got the problem fixed. Thanks for the help =)


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3517
by: Andrew Crowe | last post by:
Hi guys, We're using the ISAPI version of PHP with IIS5.0 On some websites for some reason any php file in the websites root is given the path winnt/system32 (getcwd() returns "C:\WINNT\system32"), while files in a folder are given the correct dir. To fix this I created a file that's included to all the files from php.ini
3
2476
by: todd smith | last post by:
having some strange problems with Python2.3 on windowsXP. im trying to access shares and the os.path.isdir function _always_ returns false even though the directories are there and i can os.chdir, os.listdir it in the python shell. i've followed the FAQs rule of putting the trailing '\\' on the share name with no luck heres my sessioin: >>> os.path.isdir('\\\\ren\\backup\\') False
0
1739
by: Tom McDavid | last post by:
I'm trying to learn more Python and have come across a strange behavior. I have Python2.3 installed on a Win2K machine. If I start the python command line, I can do the following: Python 2.3.2 (#49, Oct 2 2003, 20:02:00) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.getcwd() 'C:\\Python23'
0
1022
by: EAS | last post by:
Whenever I open a python program using a normal console window, it says: 'import site' failed; use -v for traceback What does this mean and how can I get rid of it? Also, I have this one program that won't stay open at all; when I into IDLE and run it there to see what the problem is, it just says: >>> =========================== RESTART ============================ >>> then it starts the program. How do I fix this? Here's the code for...
1
1613
by: Michael McGarry | last post by:
Hi, I am having a problem making a widget appear. I have 5 widgets which are windows with no parents. 3 of the widgets appear without a problem the other 2 widgets will not appear when I invoke widget.show() from within a handler for another widget. I am completely clueless as to why these 2 widgets will not draw. One of them is simply a wait window I want to appear while I am performing a time consuming task. Here is a snippet of...
6
3349
by: Dreamcatcher | last post by:
Hello, I'm trying to learn some C, reading my book, Beginning Linux Programming I came across the following program. The program is supposed to walk through directory's and print all its subdirectories. However the program never seems to get out of the loop its in. I tried finding the error but I don't see where it goes wrong, hopefully someone can shed a light on this, source code is pasted below
3
5083
by: dannycolligan | last post by:
I have a strange problem with os.chdir... here is my script that I am using to edit the filenames of my music library: #!/usr/bin/python from os import * chdir("/home/chainlynx/Desktop/Music") for artist in listdir(getcwd()): print "===ARTIST: "+artist
5
10523
by: HMS Surprise | last post by:
Tried executing os.chdir("c:\twill") from a python Tk shell and got the error message: WindowsError: The filename, directory name, or volume label syntax is incorrect: 'c:\twill'. I have the directory exists as I copied the name from the explorer window that was open to it. What is wrong with the syntax?
0
1635
by: Julien Biezemans | last post by:
Hi everyone, I've written a file:// scheme stream wrapper that acts like chroot() (but is more flexible, does not require root privileges and works on any platform). Everything works just fine except that chdir() still stat()s through the native PHP filesystem handler. This means that it is not possible to chdir() to a "jailed" directory, except if by chance its path also exists in the real local filesystem. Imagine my file:// wrapper...
0
10372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3854
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.