Re: [PHP] ftp_put and ftp_chmod does not work



João Cândido de Souza Neto wrote:
Hello everyone.

I have got some parts of my system where some files are sent and i use ftp functions to save suche files.

When i run it in my local machine, it works fine but, when it is on the server i got some errors.

I was using ftp_put to copy such files from upload_temp folder of php to my system own folder and it does not work, i thought it could be because the ftp user has no permission in upload_temp folder of php.

Most likely. ftp users are usually locked in to their own home folders and can't access any other parts of the system. It's simply a security thing.


Then i tried to use php_chmod to give permissions for the apache user, move_uploaded_files to move such file and ftp_chmod agais to remove permissions. It does not work too, i think it is because the server has safe_mode on.

chmod will be affected by safe mode (please read the documentation):

When safe mode is enabled, PHP checks whether the files or directories you are about to operate on have the same UID (owner) as the script that is being executed. In addition, you cannot set the SUID, SGID and sticky bits.


move_uploaded_file will always fail because the file isn't uploaded through a form. The documentation makes this rather clear (see also is_uploaded_file).

--
Postgresql & php tutorials
http://www.designmagick.com/
.



Relevant Pages

  • Re: [PHP] File Upload Security and chmod
    ... The FTP will be slower, ... your files at will in PHP. ... all of the directory creation and permissions changes? ... upon the permissions the parent folder. ...
    (php.general)
  • Re: [PHP] Creating thumbnails using Image Functions, then saving to folders
    ... PS You probably CAN set up FTP access and use PHP FTP to shuffle files ... I am looking to create a thumbnail from an uploaded image, ... folder chmod'd world read/writable for the process to work. ...
    (php.general)
  • Re: [PHP] ftp_put and ftp_chmod does not work
    ... I was using ftp_put to copy such files from upload_temp folder of php to ... the ftp user has no permission in upload_temp folder of php. ...
    (php.general)
  • Re: can i get PHP to use my Linux username and password?
    ... > I've been setting up websites on our webserver using FTP. ... > get PHP to create directories at the top level of our websites. ... > allowed to write into the folder of htdocs, ...
    (alt.php)
  • Mapping and security
    ... I've added a mapping for PHP on IIS6. ... I have to give permission to (and what permissions? ... the PHP session processing requires some folder where it ...
    (microsoft.public.inetserver.iis.security)