Solved

Difference between PHPINFO and WHICH PHP on Mac

Posted on 2011-09-03
1
2,020 Views
Last Modified: 2013-12-13
Hi,

I have just installed MAMP on my Mac, without an issue.

However, I have an issue where the PHP.ini file being used by Apache (installed via MAMP) appears to be different from the PHP.ini file being used by the CLI.

Here are the details...

I am trying to install the ViMP CMS system on the machine, which requires the SourceGuardian extension to be installed.

The SG extension was installed with no problem, and details of the extension are showing up in phpinfo().

As part of the setup process, Vimp requires a command to be entered in the CLI, which executes a php file, which is encrypted using SourceGuardian.

However, when I attempt to run this php file, it crashs on the 2nd line, reporting that it cannot find the SourceGuardian library.

I investigated further, and checked the PHP.ini file that was being used.

Reported by Apache via phpinfo(): /Applications/MAMP/bin/php/php5.3.6/conf
Reported by CLI via "which php": /usr/bin/php

This at least seems to explain why it can't find the SG library, as it is not specified in the /usr/bin/php version of the php.ini file.

I understand that PHP comes preinstalled, but not activated, with the Mac. It has not been activated.

Can anyone give any advice??
0
Comment
Question by:trumes
1 Comment
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 36478647
Your understanding is correct and many installations use separate 'php.ini' files because things that are available thru the web server cause errors in the command line.  However, I think your setup is even more complicated because I don't think you're seeing the same versions of PHP.  You can run 'phpinfo' at the command line to see what version it is reporting and where it thinks it's files are.  If it doesn't run then you might go to the directory where the MAMP PHP is located and try running it there.

Because OS X comes with PHP, MAMP doesn't use the 'standard' directories for it's versions and you are probably having to use a different port too.  Here's an article about using the MAMP version for CLI: http://stackoverflow.com/questions/954910/how-to-run-a-php-script-from-the-command-line-with-mamp
<?php phpinfo() ?>

Open in new window

0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

770 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