How do I run stand-alone PHP scripts on Windows

JoeTodd
JoeTodd used Ask the Experts™
on
PHP V5.2.8, Windows Vista.  
I took a quick shot at running PHP stand-alone PHP scripts from a command line prompt.  First thing that happened is that my php file popped up in the editor.  No surprise after a quick thought about it.

Anybody know how to do this?

Thanks in advance,

Joe Todd
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2008

Commented:
Run it from command line. If php is installed in c:\php5:

cd \path\to\script\folder
c:\php5\php scriptname.php

Author

Commented:
Well, it seems to be closer in that it appears to attempt to execute the script.
The script is a simple
 phpinfo();

Hoping that this wouldn't introduce any internal script errors.  Do I need other commands in the script?

What happens is the the command is echoed in the command window, quickly followed by
a pop-up window saying "CLI has stopped working".
Top Expert 2008

Commented:
The php file must have php tags:
<?php
phpinfo();
?>

Open in new window

Author

Commented:
Much, closer, now I get the output from phpinfo() before I get the "CLI has stopped working" pop-up.

Thanks for your quick replies,

Joe
Top Expert 2008
Commented:
I don't know why you get that message... I googled it, and it seems some people got this message because of a bad mysqli DLL. If you have mysqli enabled, try commenting out this line in php.ini and restart the web server service:

extension=php_mysqli.dll

...change it to:

;extension=php_mysqli.dll

If that helps, try replacing your php_mysqli.dll, or install a newer version of php... or just don't use mysqli.

If it does not help, there must be some other reason for the error. Try to install a newer version of PHP, current version is 5.2.10.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial