shell - php to write a file as root user -


i have script running on plesk latest version , plesk not have write permissions. have write configuration file values database.

i tried following,

$pathconn =  $_server['document_root']."/mysite/_conn.php"; if(file_exists($pathconn)){     chmod($pathconn, 0777); } $file_contents = file_get_contents($pathconn); $file_contents = str_replace("webuser_admin", $username."_admin", $file_contents); $file_contents = str_replace("webpass", $mysql_password, $file_contents); $file_contents = str_replace("web_db", $username."_ss", $file_contents); file_put_contents($pathconn, $file_contents); 

the php variables coming database , need update _conn.php file variables run website. cannot because of permission issue.

is there other way that? read somewhere can apache or root user. not sure mean. please..

depending on linux distribution installed in vps have type different commands steps remain same :

1.you have log in server ssh

2.find name of web server username

3.give permissions web server (chmod, chown) directory want write data


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -