I have added this to path:C:\xampp\php. separate by semi colon, & when I put this address (localhost/myfiles/hello.php) on the browser the file was opened properly, so, why cant it be opened in cmd?& I always get this message:Windows cant open this file.
1 Answer
command is looking for an absolute path to the file, not an address
$ php ../path/to/myfiles/hello.php
edit
Upon re-reating your question, I could also assume your forgetting to add the php command to the command. Adding the path to PHP in XAMPP allows you to execute the php executable through the command line interface. So you run php and then the switch configs and then the filepath.
6 Comments
Sunny300
OK, I put this command you gave & get this:couldnt open this file.
RedactedProfile
if you type
php -v what do you see?Sunny300
PHP 5.5.11 (cli) (built: Apr 8 2014 15:07:14) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
Sunny300
Now I sucseeded opening files by writing this syntax:php C:\xampp\htdocs\myfiles\jim.php my syntax was wrong, Thank you
Sunny300
And yes I was forgetting to add php command to the command. Thank you
|
cdthrough cmd to get to it and use DjDarkViper's answer.PATHglobal environment variable. This allows him to run any executable in that directory, from anywhere on the system (in this case, php.exe, which Windows CMD automatically adds the.exeaspect, allowing you to just sayphp)c:\progra~1doesn't work, butcd c:\progra~1works