Confusion with cli / apache php's

Ryan Schmidt ryandesign at macports.org
Tue Dec 2 21:25:31 PST 2014


On Dec 2, 2014, at 10:04 PM, Jeff Greenberg wrote:

> I have php53 thru php56 installed. My ide (PhpStorm) is pointing at php55, for which I have xdebug installed. I could get xdebug to work fine from inside the ide on a given script, or from the command line, but not from the browser.
> 
> The PhpStorm folks finally asked me to send the output of phpinfo from the browser, which is when I discovered that php under apache is running 5.4, without xdebug. 
> 
> I googled and read an article that explains about using port select, but apparently that changes the cli version, which is already correct. it also explains changing the loadmodule line in the apache config to point to the correct php version. This is when I discovered that the only mod_php5-.so file I have in the apache modules directory is mod_php54.so.
> 
> So, 3 questions:
> 1. How/From where do I get other mod_php--.so files?

To use PHP 5.5 from MacPorts Apache 2, install the php55-apache2handler port.

> 2. Is there an automated way to switch php versions under apache like there is for the cli?

Not at this time. Would it really be useful or desired for "port select" changed this? Some existing discussion on this is here:

https://trac.macports.org/ticket/45999

For now, edit your httpd.conf to point to the specific PHP version of the PHP Apache 2 handler that you want to use.

> 3. Do I need to install xdebug separately for the php instance under apache if it's already installed for the cli instance?

No, you don't need to do that / it's not possible to do that. Any PHP extension that you've installed for a particular version of MacPorts PHP will be available to all MacPorts PHP SAPIs that you install for that PHP version.

> I'm unsure whether there are actually 2 different copies of php or whether the loadmodule just gets some initial things from the .so file and then uses the php files from /opt/local/lib

PHP is offered in several different "SAPI"s: a command line version, a FastCGI version, an FastCGI Process Manager (FPM) version, and an Apache 2 module. Each of these is in and of itself a complete PHP environment, just tailored to be used in a specific way. Install the one(s) you want to use. For a given PHP version, all of these SAPIs use the same set of versioned PHP modules.



More information about the macports-users mailing list