[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


installed PHP 5.2.6 on windows (SBS2003) - command-line PHP not working

Posted on 2008-11-10
Medium Priority
Last Modified: 2013-12-13
Having installed PHP5 I wanted to establish it works from CLI (as not working via IIS)
I have a simple script called test.php that contains the line:

echo "something";

when I run it from the windows command line, as per

> php -r test.php

it just returns a blank line !
Any ideas ?

running SBS2003
I installed php-5.2.6-win32-installer.msi from the php\downloads site
This installed a seriously chunky php.ini file which I had to go through and remove any extensions that were causing >php to error

Question by:zorba111
  • 3

Accepted Solution

obareey earned 1500 total points
ID: 22920230
-r option is for running code only. for example;

php -r echo(\"something\");

escape character used for windows not to take " as for command line.

you should use "php -f test.php" or just "php test.php"

php -h for more information

Author Comment

ID: 22920402
sorry, I made a typo when I posted the original - the line actually was

> php -f test.php

it still takes about 3 secs to execute, and returns a blank line.

For reference I've attached the php.ini file I'm using


Author Comment

ID: 22920978
OK, got this working

I basically went thru' the PHP.INI file and commented out any extensions I knew for sure I wouldn't be using. Managed to chop the number of loaded extensions down to about 20 (verified by running "php -m"), from a possible 120 that I inherited in the default PHP.INI file that came with the installation (of which I'd commented out about 20 to get to this post).

Either the 100 or so extensions I was loading made PHP too bloated to run (and maybe it hit some limit, set in PHP.INI - e.g. total memory size, and then fell over), or one of the extensions I was loading was dodgy, and the very loading caused a run-time error (but not a "linking" error, as it were).

I think whoever was responsible for the initial PHP.INI file in the latest windows install should take note, and provide something lightweight so ppl can be up and running - "less is more" as they say

Author Closing Comment

ID: 31515007
solved it myself, but thanks for responding
I think it would have taken someone else a long time to fix this, unless they read my PHP.INI file in detail, they wouldn't have known how many extensions I was loading !

thanks anyway

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month19 days, 5 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question