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. Link to comment https://forums.phpfreaks.com/topic/43913-chmod/ 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 Link to comment https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213175 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. Link to comment https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213178 Share on other sites More sharing options...
fert Posted March 23, 2007 Share Posted March 23, 2007 ftp_chmod only works with PHP 5 Link to comment https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213182 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. Link to comment https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213185 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)); } } Link to comment https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213200 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); ?> Link to comment https://forums.phpfreaks.com/topic/43913-chmod/#findComment-213284 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.