Question

I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows vista business 32bit. I tried to install everything manually (one thing at a time, apache, postgresql and php (all the latest stable releases)) and after I get everything up and running.

Whenever I try to run a script on my machine, I get a "What do you want to do with the *.php file?" dialog. The dialog is the browser's open/save dialog

I'm just trying to get the output of phpinfo() to make sure everything is up and running...

I already tried to mess around a bit with the Apache conf file, but since I don't know much about what I'm doing, I reinstalled everything again and the problem is still there. I kinda get the feeling it must have something to do with the PHP thingy isn't correctly installed.

When i try to get the output of phpinfo as in:

<pre><?php
   phpinfo();
?></pre>

I get the browser's "Open/Save" dialog for the *.php file.

Was it helpful?

Solution

You should have something like this in your httpd.conf file:

LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/php"

Make sure that's in place, and don't forget to restart apache!

In Windows, the default location for your conf file is C:\Program Files\Apache Group\Apache2\conf\httpd.conf

OTHER TIPS

You can also have a look at the official page of PHP in the install section.

There is a closer link if you are on Windows.

And you can also use some precompiled installer for this like XAMMP and install Postgres after all is set up and running with the web server and php.

are you on Windows?

I use Wamp server, which is an excellent way of getting Apache, MySQL and PHP installed and configured without any hassle on Windows.

If you want to use Postgres instead, provided that you've got it installed separately it will work fine. (one great thing you can do with Wamp is add and remove PHP extensions via a GUI pretty much on-the-fly, and pgsql is one of them).

Maybe somebody can help, but you'd be much better off if you'd provide some relevant details.

What sort of system are you using? Be specific.

What do you mean by "everything up and running"?

What are you doing when you "try to run a script"?

What installation procedures did you use? (If you were following them off a script or how-to, we at least need to know where to find the script or how-to.)

We don't automatically know these things. What seems obvious to you may not be clear to us, and what seems irrelevant to you may turn out to be crucial.

In httpd.conf, make sure the PHP module is being loaded and that that line isn't commented out. (Comments in httpd.conf starts with #.)

Also what OS are you running?

I had the same problem, You need to configure apache and add the php module... e.g I compiled the php from source as well as the apache. After doing so I then copied the libphp5.so from php/lib dir in to the apache/modules dir. Than you have to add php in the http.conf

LoadModule php5_module modules/libphp5.so

AddHandler php5-script php

you can then restart apache....it's not the most elegant of solutions but it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top