Web Hosting Talk







View Full Version : PHP scripts won't execute in browser


m3avrck
09-24-2002, 01:10 PM
Hi, I've got what I thought was a simple problem.

I'm working on Linux with Apache and I've installed the latest version of PHP as a CGI binary.

I can run PHP scripts at the command line, without a problem. However, I want to also be able to run these scripts in the browser (like a normal php page).

What do I need to add to httpd.conf to make this happen? I tried addint the AddType for php but that doesn't seem to solve this.

Or do I now to need install PHP as an Apache module as well?

Anyone?

projo
09-24-2002, 01:20 PM
I have not heard of a browser that would execute embedded PHP. PHP is basically a server-side language like Perl. Even though I run PHP under Windows for some local programming I have not seen a browser addon for this. Of course, on the server, a normal .PHP program would execute and not deliver PHP code (this delivery sometimes happens when there is a coding error). There might be a way to print the code as a string and have it delivered to the browser, or maybe embedding it in a .html page. Hmmm.

m3avrck
09-24-2002, 01:28 PM
Hmm, I think might have stated my problem wrong. I don't want to execute the PHP scripts in the browser.

All I want to able to do is visit the page in my browser, test.php and it work, like a normal PHP script.

I mean it works great at the command line as a PHP CGI binary. But I know there is a way to get it to run in the browser. Do I just have to install as PHP apache module as well? Or is there another way?

CChard
09-24-2002, 03:47 PM
That is what execute the PHP scripts in the browser means. :)

m3avrck
09-24-2002, 04:32 PM
Ok, I think I should probably restate my problem, as I think I that was source of my larger problem.

What I want do is the following: run php code through the web server (Apache) and serve this to webpages & also run php code from the command line in Linux.

Is there a way I can be happy with both? Do I install PHP as a apache module or CGI binary to accomplish this? If Apache module, what do I have to do t get scripts to run at the command line? Or is it just php ScriptName ?

thanks

dreamrae.com
09-24-2002, 04:41 PM
hrm

RackNine
09-24-2002, 04:43 PM
mav,

You can run php as CGI in apache, the module is not required. Check out php.net for details on doing this. I'd recommend using both the module and runtime if you're planning on a large system with command-line scripts as apache's php module executes php code faster than when parsed through cgi.

-Matt