tcorbeil Posted March 23, 2007 Share Posted March 23, 2007 Can't get this work guys... can you's help? !ftp_chmod($connection, 777, $Subpage); $Subpage is the variable that holds the directory name.. I keep getting this error: Fatal error: Call to undefined function: ftp_chmod() in ..... Thanks in advance.. T. Quote Link to comment Share on other sites More sharing options...
fert Posted March 23, 2007 Share Posted March 23, 2007 looks like you don't have the ftp extension Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted March 23, 2007 Author Share Posted March 23, 2007 Hey fert.. you lost me.. can you clarify? I have the following 3 lines in my script to which the 2 first ones work perfectly.. !ftp_chdir($connection, $currentdir); !ftp_mkdir($connection,$Subpage) ; !ftp_chmod($connection, 777, $Subpage); So basically, go to a specific directory, make a new directory and then make the new directory CHMOD 777. Any further input would be appreciated.. T. Quote Link to comment Share on other sites More sharing options...
fert Posted March 23, 2007 Share Posted March 23, 2007 ftp_chmod only works with PHP 5 Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted March 23, 2007 Author Share Posted March 23, 2007 Hey fert. Your right... version loaded on the server is 4.4.4.... Do i have any alternatives?? T. Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted March 23, 2007 Author Share Posted March 23, 2007 Ok, sorry for the bother.. I got it... add this to the beginning of the script to create function.. if (!function_exists('ftp_chmod')) { function ftp_chmod($ftp_stream, $mode, $filename) { return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename)); } } Quote Link to comment Share on other sites More sharing options...
jitesh Posted March 23, 2007 Share Posted March 23, 2007 <?php $file = 'public_html/index.php'; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to chmod $file to 644 if (ftp_chmod($conn_id, 0644, $file) !== false) { echo "$file chmoded successfully to 644\n"; } else { echo "could not chmod $file\n"; } // close the connection ftp_close($conn_id); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.