No way to Chmod.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Owe Blomqvist
Forum Commoner
Posts: 33
Joined: Wed Oct 16, 2002 2:27 pm

No way to Chmod.

Post by Owe Blomqvist »

Hi.
I have this issue with chmod.
the webserver says "permission denied" after i chmod a directory i created with ftp_mkdir( );

The website is on a webhotel with php 4, mysql and it uses Linux and apache.
Basicly what i do is this:

Code: Select all

<?php
$ftp_con = ftp_connect( FTP_HOST, FTP_PORT );

if( ftp_login( $ftp_con, FTP_USER, FTP_PASS ) )
    {
        if( ftp_mkdir( $ftp_con, "/public_html/users/owe" ) )
            {
                chmod("/home/owe/public_html/users/owe", 0777);
            }
    }
ftp_nclose = ftp_quit( $ftp_con );
?>
It creates the folder allright, but the chmod command returns:
Operation not permitted in /home/owe/public_html/test/ftp.php

I have allso tried to use ftp_exec(), but it returns:
SITE EXEC is an unknown extension in /home/owe/public_html/test/ftp.php

If somebody knows how to deal with this, please help me out.
Allso, Why isn´t there a ftp_chmod( "ftp_connection", "chmod" ) function?
Regards,
Owe Blomqvist
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

i know this is basic, but find out how it makes it. are you the owner of the directory?
Owe Blomqvist
Forum Commoner
Posts: 33
Joined: Wed Oct 16, 2002 2:27 pm

Post by Owe Blomqvist »

Yes i´m the owner.
As far as i can see, chmod() uses the anonymous web browsing account, which in my case is called "nobody", And not the ftp account which is the owner account. Please correct me if i´m wrong about this.

I´m a bit buffed over the lack of a ftp_chmod( "ftp_connection", "file", "chmod" ) function.

Regards,
Owe Blomqvist
Owe Blomqvist
Forum Commoner
Posts: 33
Joined: Wed Oct 16, 2002 2:27 pm

Post by Owe Blomqvist »

Please.
Somebody has to know something about this.
People succesfuly use chmod all over the forum.
I´ve spent the whole day figuring out how to do it, without using Cute FTP.
Judas
Forum Commoner
Posts: 67
Joined: Tue Jun 10, 2003 3:34 pm
Location: Netherlands

Post by Judas »

Do you have TELNET acces to the ftp dir. ?
Owe Blomqvist
Forum Commoner
Posts: 33
Joined: Wed Oct 16, 2002 2:27 pm

Post by Owe Blomqvist »

No.
I´m sorry, No Telnet.
I don´t know if this matters, but this is the directory structure i see upon connecting to the host by using cuteftp:

etc
mail
public_ftp
public_html
<------ this is where the homepage resides. And where i try to create the user directories.
tmp
www
<------ same folder as public_html( ? )

Thanks for trying to help me out.
Regards,
Owe Blomqvist.
Post Reply