Solved

Apache, PHP & Postgres Setup

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 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

19 Experts available now in Live!

Get 1:1 Help Now