where is PHP in OSX Server?

Discussion in 'Mac OS X Server, Xserve, and Networking' started by Dewdman42, Mar 28, 2016.

  1. Dewdman42, Mar 28, 2016
    Last edited: Mar 28, 2016

    Dewdman42 macrumors member

    Jul 25, 2008
    I am running OSX Server 3.x under Mavericks, mainly to use as Time Machine service for the other macs on my network. First question, I want to have PHP 5.6 with various extensions, which don't appear to be included with 10.9 nor with OSX Server. The web service in OSX Server has a checkbox to enable PHP. Ok, but where is that being used from? Is OSX Server providing some version of PHP somewhere, and if so where it is kept in the file system?

    A particular PHP based portal I want to use needs some PHP extensions. Installing the full and latest php5.6 puts PHP into a new place, user /usr/local/php5. But whatever OSX Server is doing it appears to be using some other distribution of PHP from somewhere and I guess has its own configuration for apache to use from that other place, wherever it is...

    Does anyone have any information about this..or suggestions about whether I should just turn off this service in OSX Server and install or configure apache more directly as if OSX Server isn't there, or how I can update PHP for use within OSX Server's web service?

    I'm also going to ignore OSX Server's FTP and use pure-ftpd. There is nothing else in OSX Server I plan to use, I really only need it for Time Machine...so I wish there was a lighter weight way to do that, but it appears there is not.
  2. theluggage macrumors 68040

    Jul 29, 2011
    There's a version of PHP included in Mavericks, installed in various locations under /usr and /etc. Remember that the PHP you're enabling in Server is actually adding the PHP plug-in to Apache. (In fact, Apache and PHP are there in all installs of OS X - the Server add-on just provides the GUI).

    The built-in versions are enough for may people (you can enable PHP 'manually' if you don't have Server) and have a nice (but limited) configuration GUI, but if you want a newer version of PHP, or plug-ins not included in OS X, then yes, its probably easier to run your own PHP and Apache. Make sure that PHP *and* the web server are turned off in Server, or when you install your "own" Apache you won't be able to run it on the default port (80). Then install your own PHP and Apache somewhere away from the system-installed one so Server won't mess with the config.

    Easiest option is MAMP (https://www.mamp.info/en/) which gives you an all-in-one Apache/PHM/Mysql stack in a self-contained app folder.

    Or, if you fancy yourself as a bit of a power user, either of the open source package managers:
    ...will let you install Apache and PHP.

    I use MacPorts, which lets you choose various versions and lots of optional PHP modules. You'll need XCode to install the compilers etc. to use a package manager - but you may need that anyway if you use an odd extension.

    Lots of HOWTOs out there if you google...
  3. Dewdman42 thread starter macrumors member

    Jul 25, 2008
    so you don't recommend using the web service in OSX Server if I have to upgrade PHP? You think I should turn it off in Server and enable Apache manually as if I didn't have Server installed? Why is that?
  4. theluggage macrumors 68040

    Jul 29, 2011
    First, I've never tried upgrading PHP using the stock OS X version of Apache so I can't comment. If anybody else chips in with instructions for this then, fine.

    Second, when I tried OS X Server, the GUI features for creating websites weren't exactly must-have (and you say that you only installed Server to get Time Machine). Maybe they have improved since then, but when I tried to use them they lacked any (documented) way of including custom httpd.conf entries without breaking the GUI.

    My opinion is that, if the OS X Server as installed does what you need from the GUI, fine, but if you need more control (e.g. a newer version of PHP, additional modules) and aren't scared of editing a httpd.conf file then, in the long run, its easier to just install your own PHP/Apache stack and be confident that Server won't mess with the config files.

    I'd certainly have a look at MAMP, which neatly keeps everything under a single application icon.
  5. Dewdman42, Mar 30, 2016
    Last edited: Mar 30, 2016

    Dewdman42 thread starter macrumors member

    Jul 25, 2008
    when say you MAMP has everything under an app icon, do you mean that all of its files are self contained inside the .app package bundle?

    I did recently find this support document which gives some hints about how to tweak stuff like httpd.conf and have the GUI respect it:


    though the above does not seem to completely apply to me with mavericks...so I dunno..

Share This Page

4 March 28, 2016