1

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.

5
  • Either go into that directory or quote the full path because there is a space in it. Or use the old trustworthy progra~2 instead Commented Jan 2, 2014 at 0:54
  • sorry, not sure i understood Commented Jan 2, 2014 at 0:55
  • What part is not clear? Commented Jan 2, 2014 at 0:55
  • i understood that i cannot run it because of the spaces in the directory, is that right? Excuse my poor english Commented Jan 2, 2014 at 0:59
  • When you open a command prompt, and you are entering these commands... what does the path show in the command prompt? Commented Jan 2, 2014 at 1:04

2 Answers 2

1

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
Sign up to request clarification or add additional context in comments.

3 Comments

Hi! Thanks for your post, i am sure i am making progress. I do it as you said, and i got different messages, now it shows: Successfully established connection to the database Event reporting is not allowed at the moment. Reasons: Pre Startup or Post Shutdown This means that the file ran ok?
It sure sounds as if the file ran... I'm not sure what the expected output is, but your comment does seem to indicate that the php file ran "successfully" and generated some type of output.
Yes, i created a simples hello world script and it ran ok, showed the result on the CLI, perfect! Thank you so much! Right and best answer.
1

If you write

php dummy.php

you must be sure that your current directory is

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

1 Comment

could you explain how do i do that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.