dongqindan4406 2015-06-16 10:56
浏览 37

与upload_tmp_dir和open_basedir发生冲突

I have a web server (Debian, Nginx) with multiple sites written in PHP. For security reasons, I'm restricting each site with open_basedir by specifying it as fastcgi_param in the Nginx configuration:

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_index  index.php;
    fastcgi_pass   unix:/var/run/php5-fpm.sock;
    include        fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  SCRIPT_NAME      $fastcgi_script_name;
    fastcgi_param  PHP_VALUE "open_basedir=$document_root";
}

This does however complicate file uploads from frontend, as the default temporary directory (upload_tmp_dir) is outside the open_basedir. The optimal solution would be to add it as another fastcgi_param:

fastcgi_param PHP_VALUE "upload_tmp_dir=$document_root/wp-content/tmp";

This doesn't work, though, as it seems like upload_tmp_dir must be set in php.ini - which wouldn't work with my multiple sites.

How can I solve this and still maintain the open_basedir?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统