0

Actually I have been programming in PHP for a while, but my experiences about PHP is through VPS or some local environment like XAMPP. I was trying to install xDebug/homebrew when I come across this enter image description here

It says "if you are on PHP 5.3", only after reading this did I realize I already had PHP "installed" on my Mac(I think it comes with Mac OS) and this is where I got confused. I need something clarified:

1)I have XAMPP on my Mac, does its PHP interfere with what comes with Mac?

2) If I install Apache on my Mac, does it have its own PHP too? And after installing it, I will be able to use my Mac as a server right? What does this have to do with the server that is already running through XAMPP?

3)Back to what I was doing (installing xDebug), I think I need to install xdebug on xampp's PHP, but following this instructio, it seems to me that I will only install it to Mac's PHP. If this is true, how do I install xDebug to XAMPP?

1
  1. To figure out whether you have several PHP installed, you may try to run from shell:

    $ which php -a

    If you got one - then you are fine.

    If you discovered, that the first line goes not the one which you installed, ensure that you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:

    PATH="/usr/local/bin:$PATH"

  2. and questions #3: it seems you are confused. XAMPP already includes Apache, so you don't need to install anything separately. XAMPP is an Apache distribution containing MariaDB, PHP, and Perl. You may add xdebug to XAMPP package, by reading one of tutorials for OSX.

  • which php -a only returns one line: /usr/local/bin/php. From your answer, I conclude that Mac's PHP and XAMPP's PHP are two different things, am I right? I could have a php 5.5 installed on my Mac and a PHP 5.0 coming with xampp, correct? – shenkwen Mar 7 '16 at 17:07
  • yes, in practice you may have several versions of PHP installed, but you need to separate them somehow. I can think of two scenarios: 1. to bind them on different ports. 2. so switch them manually, or via script alike: github.com/conradkleinespel/sphp-osx – Farside Mar 7 '16 at 17:12
  • Thank you! i thought I understood already but when I read on the page I was reading, I got confused again. Please take a quick look at code.tutsplus.com/tutorials/…, the "Install Xdebug" section. – shenkwen Mar 7 '16 at 17:18
  • What confuses me is: I never used MAMP before but I think it is about the same thing with XAMPP. To my understanding, XAMPP comes with its own PHP copy, independent from the one already installed on(or come with) Mac OS. When I did "brew install php54-xdebug", I think I install xdebug to OSX's PHP, does this also affect MAMP's PHP? (Because the next step is to configure with MAMP). If yes, so MAMP's PHP is somewhat associated with OSX's PHP? – shenkwen Mar 7 '16 at 17:19
  • @shenkwen, I'm sorry, but the scope of questions you are asking here in comments is out of topic. There are good tutorials on this, just google. I'd recommend to go XAMPP (as it's simple LAMP stack, nothing more), not MAMP, but you are right, they are alike, it's more the matter of taste. How to configure and install xdebug I already answered in my answer, you got the link, just do instructions and you'll succeed. – Farside Mar 7 '16 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .