Home  >  Article  >  Backend Development  >  Get the php path under window or linux

Get the php path under window or linux

不言
不言Original
2018-04-18 15:20:271791browse

这篇文章介绍的内容是关于 获取window或linux下php路径 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

if(substr(strtolower(PHP_OS), 0, 3) == 'win')
{
    $ini= ini_get_all();    
    $path = $ini['extension_dir']['local_value'];    
    $b= substr($path,0,-3);    
    $php_path = str_replace('\\','/',$b);    
    $real_path = $php_path.'php.exe';    
    if(strpos($real_path, 'ephp.exe') !== FALSE)
    {
            $real_path = str_replace('ephp.exe', 'php.exe',$real_path);    
            }
}else{    
$real_path = PHP_BINDIR.'/php';
}
echo $real_path;

The above is the detailed content of Get the php path under window or linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn