Solved

Difference between PHPINFO and WHICH PHP on Mac

Posted on 2011-09-03
1
2,015 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 82

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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 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…

757 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

18 Experts available now in Live!

Get 1:1 Help Now