Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    run php from command line

    what the command should i use to run script file from command line?

  2. #2
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    If you have PHP installed use the command:

    php <php script>
    where <php script> is the name of the PHP script you would like to run.
    Linux User #453176

  3. #3
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris

    You can use:
    #  @(#) s1      Demonstrate one way to call php.
    // @(#) s1      Demonstrate one way to call php.
    print "\n";
    print " Hello, world from php.\n";
    print "\n";
    % ./s1
     Hello, world from php.
    Noted by:
    You can use a shebang line to automatically invoke php from scripts.
    Only the CLI version of PHP will ignore such a first line as shown

    // your script

    -- excerpt from man php on a FreeBSD 6.2-RELEASE-p1 system
    cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts