Solved

Apache, PHP & Postgres Setup

Posted on 2007-03-25
7
1,082 Views
Last Modified: 2013-12-13
Hi Experts,

I've been trying to install apache, php and postgresql on my mac os x and have them worked together.  My guide to this is obtained from http://developer.apple.com/internet/opensource/postgres.html .  However, I've run into problems when browsing my test php file at the address localhost/pg.php.  Instead of connecting to database and processing my page, my browser is asking me whether or not to download this file containing an application called pg.php.  So, can someone points out where i've missed.  I really need to get them working.
0
Comment
Question by:R6
7 Comments
 
LVL 10

Accepted Solution

by:
Luxana earned 25 total points
ID: 18791905
Hi,

apache probably do not know how to handle php files yet. Look for php module for apache. I'm on linux and I got something like this:
libapache2-mod-php5 - server-side, HTML-embedded scripting language (apache 2 module)

you should look for something similar for mac.

hope this helps
0
 

Author Comment

by:R6
ID: 18798561
hi Luxana,

I have looked it up those 2 modues for apache through fink and did not find those modules..  by the way, my apache comes with the os, its precompiled.  So, what should i do now?

thanks

R6
0
 
LVL 10

Assisted Solution

by:ivanovn
ivanovn earned 25 total points
ID: 18816697
Look for the directory where your Apache resides. In that directory there is a file:
<apache_home>/conf/httpd.conf

In that file search make sure you have something like this:
AddType application/x-httpd-php .php4 .php3 .phtml .php
Action  application/x-httpd-php /cgi-bin/php.exe

This tells Apache to render the php pages (with different possible php extensions) using php. Ensure that your action line points to the correct location of your php installation.

Also, as Luxana suggested, make sure your php module is loaded. In the same configuration file check that you have something like (it will depend on your php version):
LoadModule php4_module php4apache2.dll

Also in your php.ini file, check that your extension for PostgreSQL is enabled. This would look like this:
extension=php_pgsql.dll

Good luck.




0
 
LVL 2

Expert Comment

by:amateur83
ID: 18972429
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now