简体   繁体   中英

Running php file through command line?

Everytime I try to load a file through command line I get this message:

Could not open input file:  dummy.php

I have tried everything,

php C:\Program Files (x86)\Zend\Apache2\htdocs\dummpy.php
php dummy.php
php htdocs\dummy.php

I can't run a file! I can get php information and all other stuff, so I belive my CLI is ok.

I actually need this to run phpwebsocket, but I can't run anything through CLI.

If you write

php dummy.php

you must be sure that your current directory is

C:\Program Files (x86)\Zend\Apache2\htdocs\

You either need to enter the path without spaces, like this:

php c:\progra~2\Zend\Apache2\htdocs\dummy.php

Or, you can put quotes around the whole thing since your path does have spaces, like this:

php "C:\Program Files (x86)\Zend\Apache2\htdocs\dummy.php"

Or, when you open your command prompt, make sure to navigate to the folder that your PHP file exists in. For example, a simple navigation might look this this (type enter after each line):

cd \
cd Program Files (x86)
cd zend
cd apache2
cd htdocs
php dummy.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM