Jump to content

Giving permissions for PHP to write in folders


arunvg

Recommended Posts

Hi Friends,

I am using [color=orange][color=blue]PHP5.1.6 with MYSQL5.0 and IIS6.0 (Windows 2003 Server)[/color][/color]as an environment for my project managament tool.
I have got some error in uploading files to that tool.
I was advised to check whether the folders have permissions for PHP to write into it.I have given the permission to folders (Properties-> Checking  the column for "Write"). but it is still not working. Is there any other methods to give permissions for PHP to write into that folders.
Pls help me. ???

Thanks
Arun :(
Do you mean CHMOD?  If so you can use chmod('file path', permission ie 0777).
chmod('/opt/lampp/htdocs/hello/', 0777).  Sometimes this wont work on some servers so you have to use FTP to CHMOD it.

You can do something like this for FTP CHMOD
[code]
<?php
//Let's check if file is NOT writeable.
if (!is_writeable($file))
{
//Connect to FTP and login
$ftp_connect = ftp_connect($ftp_url);
if (!$ftp_connect)
die('Can\'t connect');

$ftp_login = ftp_login($ftp_connect, $ftp_user, $ftp_pass);
if(!$ftp_login)
die('Can\'t login');

//FTP CHMOD
if (!ftp_site($ftp_connect, 'CHMOD 0777' . $file))
ftp_site($ftp_connect, 'CHMOD 0755' . $file);
else
echo 'File not writeable';

//FTP close connection
ftp_close($ftp_connect);
}
?>
[/code]
i want you to make a folder in the htdocs and call it test then i want you to goto test.php what should have the code here in ok.

when you goto test.php there should be a file made as newfile.txt try.

test.php
[code]
<?
fopen("newfile.txt", "w+");

?>

[/code]

Hi friend,

I have tried what u have told.
I have placed the code in test.php and and placed that file in the home directory of my test sit( i am using IIS6.0) then i tried to run from there but there is nothing shown as an output also no  file is created .
I have tried another php code which simply echos some text it is working.
Can you pls identify the problem.
Thanks
Arun
friend ,
the problrm is that i have to install a project managment tool which works with PHP5.1.6 and MySQL
I installed it properly.Now when i use it to upload documents, the it is not uplading properly, but no error message is shown.
I contacted the program vendors and they told that give the folders permissions for  PHP to write into it.
Hope u now understand my problem.I tried giving permissions for the folders to be writable using the Windows 2003 .is there any other permissions to be set for PHP.
plz help me

Thanks
Arun

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.