Can't edit apache2.conf with php, I create this code above and doesn't work :
$path_apache = '/home/user/conf/web/exemple.com.apache2.conf';
if (file_exists($path_apache)){
$content_apache = file_get_contents($path_apache);
$content_apache = str_replace('DocumentRoot /home/user/web/to_replace/public_html', 'DocumentRoot /home/user/web/to_replace_with/public_html',$content_apache);
file_put_contents($path_apache, $content_apache);
}
I can edit file with SSH but for PHP the file doesn't exist. I edit Virtual Host with this and still can't edit file config :
<Directory /home/user/conf/web>
AllowOverride All
Options +Includes -Indexes +ExecCGI
php_admin_value open_basedir /home/user/conf/web:/home/user/tmp
php_admin_value upload_tmp_dir /home/user/tmp
php_admin_value session.save_path /home/user/tmp
</Directory>