I am on the latest El Capitan, and as your probably aware, your Mac comes with php installed. This can be confusing. The CLI (running PHP from terminal) actually will use your Mac’s included PHP and not the one from XAMPP. So far I haven’t ran into any issues with this. It could pose a problem if the script your running in CLI requires a specific PHP module to be installed. It could be installed for XAMPP but not for your included PHP. Say Zend, you add it to XAMPP but run the script from terminal and boom, errors. As for Yii, I haven’t had any issues from command line.
Before giving you the answer, I am going to tell you how to find out which php.ini both are using.
Open Terminal and navigate to your htdocs:
Create a phpinfo.php file:
Edit the file and enter in the command to make php spit out it’s guts:
To save and exit:
cmd + o
cmd + x
Open the file in your browser:
Run the file in Terminal CLI:
You can compare the differences. The one in terminal is what came with your Mac. I had version 5.5 where XAMP had 5.6. The included php version on mine has no php.ini loaded, error_reporting had no value. It does say that it looks in "/etc" for the ini file. Remember, that is for the PHP which came with your Mac and only applies to anything PHP that you run from terminal itself. What you are interested in, is the PHP Info you ran in your browser, as that is what XAMPP is using.
In your browser’s phpinfo that you opened, look for the line for “Loaded Configuration File”. Mine shows this:
So there you go. XAMPP’s PHP.ini on a Mac is located at: /Applications/XAMPP/xamppfiles/etc/php.ini
I wanted to point out the differences for you to keep in mind in the future, in case you ever have issues from Terminal (the CLI = Command Line Interface). So you know you actually have 2 versions of PHP.
On a Mac, you have to do this:
In the root of the Yii app is an executable file named "yii". In order to execute files on a Mac, you put "./" in front of it.
While this question is old, I wanted to answer it just in case it helps someone else in the future.