dongtongjian3127 2018-10-08 19:45
浏览 54

使用PHP编辑apache2.config

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>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度