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

Posted on 2008-11-10
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
    LVL 4

    Accepted Solution

    -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

    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

    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

    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

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    As this topic comes over and over again in different forms, I've finally decided to write a short (yea, right...) article / tutorial about pagination with PHP with MySQL database. There are dozens of these kind of tutorials, I know - I wanted to mak…
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    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 look for a specific file type in a local or remote server directory using PHP.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now