Php can it run without a web server?

Can I use PHP to run queries on a database and display the results on a page generated in HTML without using a web server ...

In fact, I only use PHP for that, and I don't host a website ... but I still had to use one since I didn't see any other solution ...

Thank you

6 answers

  1. Hello

    You can definitely execute PHP scripts by calling php.exe.

    I tested it:
    - open a Command Prompt window
    - navigate to the directory where php.exe is located (cd xxxxx)
    - run php by specifying the path to the script to execute.
    For example:
    C:\Program Files\PHP>php -q c:\wwwroot\index.php3

    The result will be output as is in the Command Prompt window. I'm not an expert in Command Prompt, but I think there is a way to redirect this to a text file...

    --
    Tittom (that's a signature)
    2
    1. If you mean "a machine" by "web server", then yes, PHP can work without the addition of a machine since packages like EasyPHP install a web server (Apache) and a database server (MySQL) locally on Windows.
      0
      1. Just... I'm talking about web servers as software... like Xitami here or Apache...

        I don't want Apache or Xitami...

        Can I make my requests only with PHP and present them on an HTML page?
        0
    2. As a supplement:

      I created a batch file (test.bat) in which I did:
      "c:\program files\php\php.exe" -q %1 >>c:\temp\result.txt

      I can now call this batch script by passing the path to a PHP script (for example script.txt, yes yes, .txt), and the result will be stored in the result.txt file in c:\temp

      Example:
      test script.txt

      Of course, you have to be careful with the current directories (cd)

      I hope this helps you...

      --
      Tittom (this is a signature)
      0
      1. Thank you Tittom!!!! This deserves to be archived! Super interesting information!!!!
        0
      2. Nice demo Tittom!

        So how's your AS 400 server? Is it running with PHP? ;o)

        -= Bobinours =-
        0
      3. I love you.
        0
    3. Thank you very much for all these answers ...

      it helped me ...
      0
      1. erf php.exe I forgot about that one =)
        Well, actually all you have to do is follow what Tittom said
        php.exe -q script.php >c:\temp\resultat.html
        and open in your browser
        C:\temp\resultat.html that way you can have a web format layout =)
        -1
        1. NO, you cannot!
          PHP is a scripting language. It is the PHP module (under Apache) that executes your requests and displays. You cannot do without a web server.
          ++ Ripper
          -2