Reputation: 359
While going through the PHP manual on how to work with Command Line Interface(Command Line PHP on Microsoft Windows)
I got to this line which says
Associate the .PHP extension with a file type. This is done by running the following command:
assoc .php=phpfile
and
Associate the phpfile file type with the appropriate PHP executable. This is done by running the following command:
ftype phpfile="C:\PHP5\php.exe" -f "%1" -- %~2
My question is where do I run those commands?
I use PHP7.2.7
Upvotes: 0
Views: 585
Reputation: 30
To associate the .php file name extension with the php file type and enable the php file type to execute PHP. EXE, type the following commands in the CLI:
assoc .php=phpfile
ftype phpfile="C:\PHP5\php.exe" -f "%1" -- %~2
Following these steps will allow PHP scripts to be run from any directory without the need to type the PHP executable or the .PHP extension and all parameters will be supplied to the script for processing.
So now, if i have a file named hello.php, in any folder , and i want to call it, i'm make :
<?php execute(hello); ?>
Or i can be typing hello in the CLI.
Upvotes: 1
Reputation: 94
you can write these command in cmd. Also called windows command prompt. Click on windows key + R on keyword and type cmd then press enter to run command prompt.
Upvotes: 0