Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

need to find PHP installation path from a Windows .cmd script without using PHP [closed]

I am building windows .cmd files which will run demo examples of our PHP tools. I have a "catch-22" problem, I need to determine how to find the PHP installation path from a Windows .cmd script without using PHP. EasyPHP does not install itself into the windows path so that is why I can't use PHP.exe.

So stated in a different way I would like to determine the information that the getcwd() command returns in php but without using PHP. So "how" does getcwd reference what information from where to determine the working php directory?

I have not been able to find file(s) or? with all the text data I might then search for which would be the referenced source of the php path information.

I did find this file ... c:\EasyPHP-5.3.8.1\conf_files\httpd.conf ${path} is mentioned (see file text below) but I can't find where this ${path} is defined, where is ${path}defined for php? NOTE: that ${path} in PHP is not the same as the windows $path environment variable! there are NO windows environment variables present which contain EasyPHP information!

partial file text .... # IMPORTANT # ${path} is used to specify EasyPHP installation path . .(text lines omitted) . # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, buet # symbolic links and aliases may be used to point to other locations. # DocumentRoot "${path}/www"

like image 911
Ron Whites Avatar asked Nov 13 '22 15:11

Ron Whites


2 Answers

Turns out there is no "universal" good way to determine what document root path is for the active PHP server. It's a catch-22 you can determine the value by running php in the web browser.

FYI I have designed a .cmd script that asks for the document root path, it's unfortunate I must ask and trust the user but that is the way it is!

like image 140
Ron Whites Avatar answered Jun 03 '23 02:06

Ron Whites


IF the php directory is in the PATH then you can see if the directory is there (in command line it is %PATH%).

like image 33
Victor Avatar answered Jun 03 '23 01:06

Victor