CHMOD problem

Hello.
Please advice.

I have an upload script that should upload an image on a server.
The problem is that it returns the following error:
chmod() [function.chmod]: Not owner in /w…
I use CHMOD($folder, 0777)

This application runs without a problem on many other servers, except on this one.
safe_mode is off, so CHMOD is not disabled by safe_mode

Thankyou for your help

chmod folder 755

The following page may be useful to you as regards configuration of safe mode.
http://www.php.net/manual/en/configuration.changes.modes.php

Note: settings may occur in php.ini or httpd.conf

Hy there, what exactly should I look for on that page ? http://www.php.net/manual/en/configu…nges.modes.php

Thx.

Pardon, copy/paste issues going on there. That one shows you where the settings will be. Safe Mode is a PHP_INI_SYSTEM type of setting, so those settings can be set from both php.ini and conf.ini

This is the page you want: Security and Safe Mode

Yes indeed, but this does not help me, because safe_mode is disabled. I believe if it would be enabled, it would disable the CHMOD function from php
http://www.php.net/manual/en/features.safe-mode.functions.php

You may confirm whether it is enabled or not by using ini_get


echo '<pre>';
print_r(array(
    'safe_mode' => ini_get('safe_mode'),
    'safe_mode_gid' => ini_get('safe_mode_gid'),
    'safe_mode_include_dir' => ini_get('safe_mode_include_dir'),
    'safe_mode_exec_dir' => ini_get('safe_mode_exec_dir'),
    'safe_mode_allowed_env_vars' => ini_get('safe_mode_allowed_env_vars'),
    'safe_mode_protected_env_vars' => ini_get('safe_mode_protected_env_vars')
));
echo '</pre>';

it’s disabled, because I asked them to run phpinfo() and to give me some details

Who is “them” ?

the “client” is a University, and so far I was speaking with a professor there. He was uploading files, through secure FTP. But they needed an application to do this more easy. Would be kind of strange to upload files through ftp, then create a website that display all images in a folder, then insert the data into db, in order to use those iamges where they want in a CMS.

Anyhow, I tried to do something like this:


// File name and username to use
$file_name= "winter.txt";
$paths = "/home/xxxx/public_html/yyy/zzz/" . $file_name ;

// Check the result
$stat = stat($paths);
$array = posix_getpwuid($stat['uid']);
$uid = $array['uid'];

// Set the user
chown($paths, intval($uid));

chmod ($paths, octdec($mode));

wonder if that works??? any ideas someone? because I am sick of always sending them a file, run some tests, and then back to me with the feedback.

I suggest that you contact the local IT staff at the university. If they’re anything like my own local one, they will have immediate knowledge of the issue and whether there is anything that you can do to resolve it.