1
votes

I installed XAMPP with PHP5.3, but now on command line, php -v always uses the Mac OS10.10 build-in PHP5.5! But I need to use PHP5.3 instead. How to config so that I can use XAMPP PHP 5.3?

I tried to modified /etc/apache2/httpd.conf to load XAMPP's PHP module, but doesn't work.

PS, I need to change the command line PHP version as I need to use Symfony 1.x version(need to run symfony commands from command line)

2

2 Answers

1
votes

You just need to add the path to the XAMPP php binary to your path. You can edit your .profile to add the path:

vi ~/.profile

This will open a new vi screen in your terminal then type :$ and hit return; That will take you to the last line. Then do CONTROL+A to append to the last line. You can now enter text and add the following:

export PATH="/Applications/XAMPP/bin:$PATH"

Then press ESC; This will take you out of editting mode. Then type :wq and hit return. That will save the file and quit vi. Then you can enter this command to load your profile (or you can just close terminal and reopen it or open a new tab):

source ~/.profile

Now if you enter the following command on the command line you should see the XAMPP version of PHP:

which php
0
votes

You could change the symfony command of your project directly, so you can change the php version by project. Add the following in the first line of the symfony file:

#!/usr/bin/env /Application/XAMPP/bin/php

Now symfony uses the given php binanry, not the one of the system.