Php can it run without a web server?
16art
-
bisous -
bisous -
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
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
-
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) -
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.
-
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) -
-
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 =) -
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