How to update/replace php script on server -
i working on update feature cms. stuck on this. scenario user able upload zip file, updater script extract , replace old one.
i have problem replacing, i've done following
<?php rename($old, $new);
i "permission denied"
using ftp_rename
:
<?php $conn = ftp_connect($host); ftp_login($conn, 'user', 'pass'); ftp_rename($conn, $src, $dest);
i
warning: ftp_rename(): rename failed. on....
is there proper way ? thanks.
depending on linux distro, php executes command specific user. check apache (or whatever server using) settings , put permission accordingly
for example in apache, set
export apache_run_user=www-data export apache_run_group=www-data
you can change upload folder owned www-data
for more information can read useful discussion https://unix.stackexchange.com/questions/30879/what-user-should-apache-and-php-be-running-as-what-permissions-should-var-www
Comments
Post a Comment