The first example you show that outputs this comes from the PHP command line (CLI) interface.
PHP 5.4.12 (cli) (built: Mar 16 2013 21:46:23)
The second example you show—which is coming from
phpinfo() via your web server—comes from the PHP module that apache loads.
PHP Version 5.3.15
How did you install the version of
PHP 5.4.12 that shows up on the command line? Also, your Apache version, is that the version installed via Mac OS X? I would run the following command to find out where the CLI version of PHP is being called from:
Note that directory. The PHP 5.4 module should be in that directory somewhere.
But wiithout knowing the details, I will recommend this if you are doing web sharing via OS X. This is based on my personal Mac OS X 10.8.3 default setup.
First, open up the Apache config file:
sudo nano /private/etc/apache2/httpd.conf
Find the commented out line that reads something like this:
#LoadModule php5_module libexec/apache2/libphp5.so
Uncomment that line and set it to the path of your PHP 5.4 module:
LoadModule php5_module /my/path/to/php54/libphp5.so
Of course chaging
/my/path/to/php54/ to actually match your real system path to the PHP 5.4 Apache module.
After doing that, restart Apache & then check the output of
phpinfo(). It should match the command line output.