How to use php on the command line?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sam

    How to use php on the command line?

    Hi,
    My question is how to use php on command line in windows

  • Erwin Moller

    #2
    Re: How to use php on the command line?

    sam wrote:
    Hi,
    My question is how to use php on command line in windows
    Hi

    Only php.exe will execute from commandline, not the sapi-variant.
    First check if php.exe is added to the path by simply typing: path
    Does it list the path to php.exe?
    (If not add it, or go to the directory where php.exe is.)

    Now type something like:
    php -?

    or

    php myscript.php

    Regards,
    Erwin Moller

    PS: Maybe you need the file php-win.exe instead of php.exe, not sure. I
    seldom use PHP commandline.

    Comment

    • sam

      #3
      Re: How to use php on the command line?

      Hi,
      But when i started php.exe through commaind line it give me the black
      screen
      and the error showing on it is:
      Unable to load /.php_gd2.dll file
      What this line means please tell me how i configure it or where I can
      find this dll file?

      Comment

      • Erwin Moller

        #4
        Re: How to use php on the command line?

        sam wrote:
        Hi,
        But when i started php.exe through commaind line it give me the black
        screen
        and the error showing on it is:
        Unable to load /.php_gd2.dll file
        What this line means please tell me how i configure it or where I can
        find this dll file?
        Hi,

        That file is the graphcislib of PHP, named GD-lib (version 2 in your case,
        which is good).

        I expect that you did comment out in php.ini this extension, so PHP tries to
        load it, but cannot find it.

        But it is hard to help you based on the limitted information you provided.
        Some thoughts:

        Do you have a good reason to run PHP from commandline?

        What does php answer if you:
        1) start->run-type cmd
        2) cd to the directory of php.exe
        3) type php -?
        (gives some information on how to use it)
        or 3) type php -v
        (gives versionnumber)

        The -? will also give you information on how to tell php which php.ini to
        use.
        Maybe make a fresh one for this application with the GD-libs commented out?

        Regards,
        Erwin Moller

        Comment

        • Andy Hassall

          #5
          Re: How to use php on the command line?

          On 5 Jan 2007 07:23:30 -0800, "sam" <samsoft206@yah oo.comwrote:
          >But when i started php.exe through commaind line it give me the black
          >screen
          >and the error showing on it is:
          >Unable to load /.php_gd2.dll file
          What is the actual error? This looks like you've seen the error but
          inaccurately retyped it; it's not worded quite like that.

          Is it:

          PHP Warning: PHP Startup: Unable to load dynamic library '.\php_gd2.dll' - The
          specified module could not be found.
          >What this line means please tell me how i configure it or where I can
          >find this dll file?
          The most likely cause is that you need to set extension_dir in php.ini to
          point to the "ext" directory in your PHP installation, as it's currently set to
          "." rather than the full path.

          --
          Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
          http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

          Comment

          Working...