doufen9815 2011-04-09 02:12
浏览 13
已采纳

如何知道我的主机php5在suphp下运行

how to know my php5 is running under suphp?

  • 写回答

2条回答 默认 最新

  • dqhnp44220 2011-04-09 02:45
    关注

    If you don't have the POSIX extension installed (it's not common on shared hosting), one option is going to be creating a new file and then checking the uid/gid it's created with:

    file_put_contents('./tmp.txt', 'Stuff!');
    echo "File UID is: ", 
         fileowner('./tmp.txt'), 
         ', GID is: ',
         filegroup('./tmp.txt');
    

    Now, the numbers alone might not be useful, but they can serve as guidelines.

    If the UID is 99, the user PHP is running as is nobody, which means no suPHP. If the UID is 33, that could be user www-data, which again means no suPHP.

    If the UID is just a few over 9000 500 or 1000, then there is a small chance that you're under suPHP. If it's way over 500 or 1000, then you may well be under suPHP.

    You might be able to actually read /etc/passwd and examine the UIDs there, but that's rude.

    However, your best bet might be checking phpinfo. suPHP might leave clues that it's running, or there might be other environment variables that you can take a peek at. For example, Apache's mod_php can not possibly be suPHP, so if you see that PHP is running as mod_php, you certainly aren't suPHP'd.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。