Opened 10 years ago

Closed 3 years ago

#37119 closed defect (fixed)

PEAR configured with incorrect php binary

Reported by: jbarros+macports@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc: pixilla (Bradley Giesbrecht), miken32 (Michael Newton), 66Ton99 (Ton Sharp), chrstphrchvz (Christopher Chavez)


PEAR ports that use PEAR's source code replacement functionality (like pear-PHPUnit) are generating incorrect references to Apple's php binary, rather than the one installed by MacPorts.

For example, in /opt/local/lib/php/pear/bin/phpunit, the first line is expanded as:


when it should be expanded as:


Install logs are showing the incorrect path is in the PHP_PEAR_PHP_BIN environment variable during the build:

DEBUG: Executing org.macports.configure (pear-PHPUnit)
DEBUG: Environment: CPATH='/opt/local/include' LIBRARY_PATH='/opt/local/lib'
TZ='UTC' PHP_PEAR_PHP_BIN='/usr/bin/php'
DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_usr_local_share_ports_php_pear-PHPUnit/pear-PHPUnit/work/PHPUnit-3.7.9/packagesource"
&& /usr/bin/php /opt/local/lib/php/pear/install-pear-nozlib.phar'

I'm not familiar with MacPorts internals, but I believe the solution may be to change the line in pear-1.0.tcl from:

default pear.cmd-php        {/usr/bin/php}


default pear.cmd-php        {${prefix}/bin/php}

Change History (10)

comment:1 Changed 10 years ago by ryandesign (Ryan Schmidt)

FYI /opt/local/bin/php as installed by the php5 port is old and is going away. The new php are /opt/local/bin/php53, /opt/local/bin/php54, /opt/local/bin/php55 as installed by their respective ports.

comment:2 in reply to:  1 ; Changed 10 years ago by pixilla (Bradley Giesbrecht)

Setting pear.cmd-php to /opt/local/bin/php54 in the pear-PHPUnit Portfile did not fix the phpunit shebang.

$ tail -n1 Portfile 
pear.cmd-php        ${prefix}/bin/php54
$ head -n1 /opt/local/lib/php/pear/bin/phpunit

comment:3 in reply to:  2 Changed 10 years ago by jbarros+macports@…

Making the change in the Portfile does not fix the problem for me either; however, making it in pear-1.0.tcl does. Perhaps the Portfile change isn't early enough in the install process.

comment:4 Changed 9 years ago by miken32 (Michael Newton)

Cc: miken32@… added

Cc Me!

comment:5 Changed 9 years ago by miken32 (Michael Newton)

It should actually be using #!/usr/bin/env php I think.

comment:6 in reply to:  5 Changed 9 years ago by larryv (Lawrence Velázquez)

Replying to miken32@…:

It should actually be using #!/usr/bin/env php I think.

That would use whichever PHP happens to come first in $PATH, which is not what we want. We want to ensure that MacPorts’ PHP is being used.

comment:7 Changed 9 years ago by 66Ton99 (Ton Sharp)

Cc: 66ton99@… added

Cc Me!

comment:8 Changed 6 years ago by miken32 (Michael Newton)

This is still a problem. Just installed pear-PhpDocumentor and am seeing the same behaviour with the wrong shebang included on /opt/local/lib/php/pear/bin/phpdoc

comment:9 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Cc: chrstphrchvz added

comment:10 Changed 3 years ago by pmetzger (Perry E. Metzger)

Resolution: fixed
Status: newclosed

In a161124315ae59e99481271f6b087b4e42b3d527/macports-ports (master):

Remove PHP PEAR modules and PortGroup

Per, which after
nine months received no objections. Manually committed because of
merge conflicts.

Closes: #56424
Closes: #34063
Closes: #35228
Closes: #37119
Closes: #37524
Closes: #37683
Closes: #38910
Closes: #39869
Closes: #46688
Closes: #53510
Closes: #53632
Closes: #57316
Closes: #57318
Closes: #57320
Closes: #57321
See: #54839

Note: See TracTickets for help on using tickets.