stomseven
stomseven

Reputation: 157

Create Web Server which can run php

I created a basic web server in Java. It can also run php code.

I execute:

php - f <file> 

to get the result and send it back to the client. It works great, however when I want to use the phpinfo(); function, it returns plain text as it is written in the manual too. How can I get the result in HTML format like Apache does?

Thank you!

Upvotes: 0

Views: 257

Answers (2)

EJTH
EJTH

Reputation: 2218

You might want to try running the file through the php-cgi interface instead (should be an executable named php-cgi or similar).. this is one of the ways you can run php under apache.. (other choice being mod php or fcgi)

Raidence, why would you make a http server with dependencies to apache, you dont get the redundancy in that?

Upvotes: 1

Simon Germain
Simon Germain

Reputation: 6844

I'm afraid that's hardcoded in PHP's binary. It detects if it's running an Apache module or the CLI binary. Since you're not invoking the Apache module, it uses the CLI one. From the manual page:

phpinfo() outputs plain text instead of HTML when using the CLI mode.

Upvotes: 5

Related Questions