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条)

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算