[英]Installing PostGresQL & MySQL in Mac OS X running MAMP?
Well, I have MAMP installed on my Mac OS X, and I've got PostGres up and running, but am wondering how I can use it with PHP? 好吧,我在Mac OS X上安装了MAMP,并且已启动并运行PostGres,但是想知道如何在PHP中使用它吗? I'm assuming that there's something I need to do where I compile PHP so that it can use both, but, I'm not sure how to do that if PHP has already been installed? 我假设在编译PHP时需要做些事,以便它可以同时使用两者,但是,如果安装了PHP,我不确定该怎么做? Or, if there's something unique I need to do to get it work on the Mac in a MAMP environment? 或者,是否需要做一些独特的事情才能使其在MAMP环境中的Mac上运行? I'm really unfamiliar with installations ,etc., so, help / direction / links, etc., is greatly appreciated. 我真的不熟悉安装等,因此非常感谢帮助/指导/链接等。 I've been googling, but think maybe I'm not even searching for the right terms... 我一直在搜寻,但是想想我可能甚至没有在寻找正确的词...
First of all, you should use a PHP script containing 首先,您应该使用包含以下内容的PHP脚本
<?php
phpinfo();
This will show you which PHP extensions are installed / enabled. 这将向您显示已安装/启用了哪些PHP扩展。
With a bit of luck, you'll have mysql
/ mysqli
/ pdo_mysql
and pgsql
/ pdo_pgsql
already installed -- which means it'll be OK from the PHP side : you'll just have to use the right functions/classes to connect to your pg and/or MySQL servers. 幸运的是,您已经安装了mysql
/ mysqli
/ pdo_mysql
和pgsql
/ pdo_pgsql
这意味着从PHP方面来看是可以的:您只需要使用正确的函数/类即可连接到您的pg和/或MySQL服务器。
您需要php postgres驱动程序,可以尝试macports安装php5-pgsql扩展
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.