FTP ERROR: could not change directory to [xxx]

Want to share what MODs you've gotten to work with EM? Happy about all the time your're saving? Want to say "thanks"? Here's the place.
Forum rules
DO NOT give out any FTP passwords to anyone! There is no reason to do so! If you need help badly enough, create a temporary FTP account that is restricted to only the files that you need help with and give the information for that. Giving out FTP information can be very dangerous!
Locked
imrich
Registered User
Posts: 38
Joined: Tue Aug 02, 2005 1:42 pm

FTP ERROR: could not change directory to [xxx]

Post by imrich »

This is a strange thing.

I orginally posted under what I thought was a relevant thread, but was informed that was the wrong place, so here is a repost hoping for some help.

I was trying to install the latest update to .18 using easymod 0.2.1a (with the ftp /../ fix).

The install of the .18 update bombed out. This was surprising as Easymod was working for me.

So I decided to see what was going on and try to re-install easymod.

Well, that didn't go very well. The failure is very similar to the one which I got when I tried to install the .18 update 'mod'.

Here is a debug output:
EM installer v0.2.1a wrote: phpBB version: 2.0.17
Working Dir: /home/user/domains/mydomain.com/public_html/forums/admin/mods/easymod
Install Step: 4
Mode:
The Error wrote: Critical Error:
Function Trace: main[3]->modio_move[2]

FTP ERROR: could not change directory to [admin/em_includes]
Current dir: []
Permissions: (including system errors)

read access :: OK
write access :: No
root path write :: No
chmod access :: unattempted
unlink access :: unattempted
mkdir access :: unattempted
tmp path write :: OK
FTP extension :: OK
Safe Mode :: OFF
copy access :: No



Recommendations:
write: buffer & ftp
move: automated FTP

Selected settings:
write: ftpb
move: ftpa
ftp dir: /domains/mydomain.com/public_html/forums
ftp host: localhost
ftp port: 21
ftp debug: false
ftp ext: ext
ftp cache: false

CWD Listing:

Code: Select all

drwxr-xr-x . 
drwxr-xr-x .. 
drwxr-xr-x em_includes 
drwxr-xr-x includes 
drwxr-xr-x languages 
drwxr-xr-x templates 
-;rw-r--r-- easymod.gif 
-;rw-r--r-- easymod_display_functions.php 
-;rw-r--r-- easymod_install.php 
-;rw-r--r-- post_process.sh 
-;rw-r--r-- post_process.bat 
Testing FTP access...
1) Logged in successfully
PWD: /
Dir listing: (5 files being listed)
[domains]
[mail]
[public_html]
[backups]
[imap]
2) CD to EasyMOD path successfully
3) wrote to phpBB root successfully

FTP access test :: successful



Notice that the FTP PWD is /

Yet the CWD seems to be /domains/mydomain.com/public_html/forums/admin/mods/easymod

Also ftp dir: /domains/mydomain.com/public_html/forums

None of these paths agree, no wonder the copyies are failing.

Any clues as to why this error is back?

I was trying to install the latest .18 code on my forum and it bombed out on me.

User avatar
Nux
Registered User
Posts: 943
Joined: Tue Jun 14, 2005 5:09 pm
Location: 3cities, Poland
Contact:

Re: FTP ERROR: could not change directory to [xxx]

Post by Nux »

And what are the correct paths?

Maybe you've changed some settings during the reinstallation? Or the reinstallation didn't have the mentioned fix...

imrich
Registered User
Posts: 38
Joined: Tue Aug 02, 2005 1:42 pm

Re: FTP ERROR: could not change directory to [xxx]

Post by imrich »

1) I made sure that the re-install had the 'ftp' fix before attempting the re-install.

2) I wouldn't have even tried the re-install if the install attempt of .18 of phpbb didn't fail with this similar error.

3) I would think that the correct path would be some what close to this: /domains/mydomain.com/public_html/forums since this is what is being displayed as the 'ftp dir:'.

My question is why does the 'Selected settings' show the 'ftp dir:' as /domains/mydomain.com/public_html/forums yet the 'Testing FTP access...' process show that the PWD is '/', which is confirmed by the display of the files and folders in '/' (basically the root directory). Shouldn't this be '/domains/mydomain.com/public_html/forums'?

4) During my several reinstall attempts I tried '/public_html/forums' and 'domains/mydomain.com/public_html/forums', or '/home/user/domains/mydomain.com/public_html/forums' which all failed in the same manner. By the way, these are all valid paths to the same place.

Thanks for any guidance in this. I'm confused why this is failing now so I'm looking for some help.

It appears the root problem is this:
FTP ERROR: could not change directory to [admin/em_includes]
Current dir: []

To me it looks like the 'Current dir' of '[]' is the root of the problem. Where does this come from? Why is it blank?

User avatar
Nux
Registered User
Posts: 943
Joined: Tue Jun 14, 2005 5:09 pm
Location: 3cities, Poland
Contact:

Re: FTP ERROR: could not change directory to [xxx]

Post by Nux »

Have you changed your main Configuration settings? There was someone that had a problem with EM because of the wrong settings of server_name or maybe script_path (can't remember...).

As for path setting then you'll find some help in the last link of my sig. Genreally the paths shouldn't have any slashes (/) at the end or begining.

As for the rest then enable ftp debug mode and run the installation again. Maybe the answer will be there somewhere.

imrich
Registered User
Posts: 38
Joined: Tue Aug 02, 2005 1:42 pm

Re: FTP ERROR: could not change directory to [xxx]

Post by imrich »

Hmmm... I believe I do have a slash at the begining. I'm traveling and away right now so I can't work on this until I get back. So when I get back I'll try getting rid of the starting slash.

On the other hand, I have to wonder why this stopped working for no apparent reason.

I haven't changed anything in my main configurations settings. My site has been very stable and EM was working just fine the last time I used it. This problem cropped up when I went to install the .18 update.

Perhaps my server provider changed some settings on the server that I am unaware of? It's hard to know.

Thanks for your time and responses.

imrich
Registered User
Posts: 38
Joined: Tue Aug 02, 2005 1:42 pm

Re: FTP ERROR: could not change directory to [xxx]

Post by imrich »

I've looked into this some more.

I'm not sure yet, but this may be a by-product of my server changing some global settings. I can't be sure and my server provider says nothing has changed.

What I see is that PHP scripts run as user 'apache'.

But the UID and GID of my folders and files are not apache, they are 'username'.

I'm not sure if this is the problem, but it appears that it may be part of the problem.

It doesn't make much sense to me as when I setup the EasyMod FTP parameters I use 'username' as the user. This should allow writes. But for some reason, Easymod can't write?

I'm still trying but not getting anywhere.

The strange thing is that this was working perfectly before. The last time I tired to use EasyMod I had no problems.

imrich
Registered User
Posts: 38
Joined: Tue Aug 02, 2005 1:42 pm

Re: FTP ERROR: could not change directory to [xxx]

Post by imrich »

My web host told me that they recently updated PHP. It appears I'm now running php 4.4.0. I don't remember what I was running before.

Could a change in PHP versions affect this at all?

markus_petrux
Registered User
Posts: 376
Joined: Fri Jun 18, 2004 10:58 pm
Location: Girona, Catalunya (Spain)
Contact:

Re: FTP ERROR: could not change directory to [xxx]

Post by markus_petrux »

Maybe they have also changed something else in the PHP settings. Did you tried the FTP sockets method?

Also, if you enable the FTP debug option in the advanced installation panel, there might be additional information...

imrich
Registered User
Posts: 38
Joined: Tue Aug 02, 2005 1:42 pm

Re: FTP ERROR: could not change directory to [xxx]

Post by imrich »

I've done some more debugging. I tried to change the mode that FTP uses (the 'PHP FTP Extention: NO' setting in easymod). This did not seem to help at all. I also turned on FTP Debug Mode, this allowed me to get an idea of where the failure occured, but I did not see any error message.

What I found is that the install of easymod is bombing out during the copy of admin_easymod.php.txt to admin_easymod.php. The previous step of deleting the older admin_easymod.php worked ok.

The new admin_eadymod.php is created, however it is not copied completely and is only 16384 bytes long instead of the 102279 bytes which it should be (the size of admin_easymod.php.txt is 102279).

To me it looks like the FTP process is crashing or terminating after exactly 16K, Hmmm... is this the size of one of its buffers?

In researching the changed to PHP 4.4.0 (my web server recently changed to PHP 4.4.0) I found this on the PHP web site at http://www.php.net" target="_blank:
PHP 4.4.1 Released
[31-Oct-2005] PHP 4.4.1 is now available for download. This version is a maintenance release, that contains numerous bug fixes, including a number of security fixes related to the overwriting of the GLOBALS array. All users of PHP 4.3 and 4.4 are encouraged to upgrade to this version.
The full list of changes in PHP 4.4.1 is available in the PHP 4 ChangeLog.
Ok, this is interesting and my web server said they will update all their servers to 4.4.1 probably later today.

But then I noticed that php 4.4.1 included a fix for an 'ftp' issue:
Fixed bug #34742 (ftp wrapper failures caused from segmented command transfer).
I don't know enough about this to know if it could cause this sort of an issue. By looking at the bug report, it doesnt' sound similar at all to me. But I thought I would mention it here anyway.

The transfer tests that easymod performs are on relatively small files. The test was moving easymod.gif around to test the ability to write, delete, chmod, etc. easymod.gif is only 6578 bytes. Sinced this is much smaller than 16K it may not see this issue.

To me it appears that the problem which I am having is because a ftp transfer of more than 16K fails. Does this sound familliar? This must be a clue of some sort.

Perhaps this will go away when PHP 4.4.1 is installed? Why do I doubt it?

Any ideas or clues would be helpful.

imrich
Registered User
Posts: 38
Joined: Tue Aug 02, 2005 1:42 pm

Re: FTP ERROR: could not change directory to [xxx]

Post by imrich »

I did some testing. I believe that this is a PHP 4.4.0 bug in the FTP functions.

I coded up this little test script to test to see if it was affected by small or large files. It works with small files (use the test script as a small source file) but it fails with a larger file (I used a 49k .pdf document as a 'large' file and it failed).

Here's the crude test script which was named testftp.php. I created a 'test' directory under public_html to test this.

Code: Select all

<?php

// Source file name. If this is the name of a small file (the name of this .php file as an example), the transfer will work without errors.
// if this is the name of a large file (Unkown size, but 49 K fails), this will fail!
//$source = "application.pdf";
$source = "testftp.php";

// name of the destination file. It will be overwritten!!
$destination = "destination.txt";

// path to the test directory.
// BE SURE to set the proper path!!
$path = "/domains/yourdomain.com/public_html/test";

// FTP parameters BE SURE TO SET user and password!!!
$server = "localhost";
$user = "yourUserName";
$password = "yourPassword";

echo "this will attempt to copy $source to $destination<br>";
echo "<br>";


if($id=ftp_connect($server))
{
	echo "connect to $server OK.";
}
else
{
	exit( "connect to $server FAILED!");

}

echo "<br>";
if(ftp_login($id, $user, $password))
{
	echo "login OK";
}
else
{
	exit("login failed");
}
echo "<br>";

ftp_chdir($id, $path);

echo "current directory is " .ftp_pwd($id);
echo "<br>";


if(ftp_put($id, $destination, $source, FTP_BINARY))
{
	echo "Put $path/$destination OK!";
}
else
{
	exit ("Put failed");
}

ftp_close($id);

echo "<br>Running PHP version " . phpversion() . "<br>";
echo "<br>";
?>
If people would try this with large files (49K) and tell us what versions of PHP they were using and if it passed or failed, it would help a lot. To test it with a larger file, you have to supply the larger file in the same directory as this program and then place it's name in the $source parameter.

For a small file, this copies the file and reports OK.

For a large file, this seems to hang and does nothing. You can see that the destination file was over written, but it didn't completely copy. It appears that the script (or the put) failed prematurely and the write didn't finish.

Does this give anyone a clue to this error I'm having?

I'm using PHP 4.4.0 and this is FAILING on a 49K source file.

I edited this code to display the PHP version number and to exit if an error occurs.
Last edited by imrich on Mon Nov 07, 2005 2:06 pm, edited 1 time in total.

Locked