Solved

Apache, PHP & Postgres Setup

Posted on 2007-03-25
7
1,088 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

786 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