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

Get the php path under window or linux

不言
Release: 2023-03-24 10:58:02
Original
1831 people have browsed it

这篇文章介绍的内容是关于 获取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;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template