contao / manager-bundle

[READ-ONLY] Contao Manager Bundle
GNU Lesser General Public License v3.0
17 stars 10 forks source link

open_basedir restriction in effect #57

Closed temperatur closed 6 years ago

temperatur commented 6 years ago

Hi, I have a Problem using the contao-manager. The manager just work fine until it gets to the post-install-cmd Script of the composer. After debugging a while I found out that this is because the PHP open_basedir is set.

So the command https://github.com/contao/manager-bundle/blob/6a9b9e0a1555fb2ccab298f03136f3bc1a39a487/src/Composer/ScriptHandler.php#L66 throws an exception because the php binary’s are not in the open_basedir.

I have tried to specify the binary hardcoded in the ScriptHandler.php

/*if (false === ($phpPath = $phpFinder->find())) {
     throw new \RuntimeException('The php executable could not be found.');
}*/
  $phpPath = '/usr/bin/php71';

and it just worked fine. Where

'/usr/bin/php71'

manager_setup

is exactly the string I specified during the Manager Setup.

I cannot change the open_basedir settings, so is there a way to take the binary’s which I already specified on the Setup of the Manager and don’t try to get it with the Symfony Function ?

ghost commented 6 years ago

The issue has been moved to contao/contao-manager#228.

aschempp commented 6 years ago

This is not a Contao Manager issue, reopening the ticket.

leofeyer commented 6 years ago

Well, it is not a Contao issue either. It seems that the PhpExecutableFinder class is not compatible with open_basedir: https://gist.github.com/eduardo-g-silva/b094b1576f9d847596e54076327ad415

The is_file(PHP_BINARY) call is the culprit, because /usr/bin is typically not within the base directory.

https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Process/PhpExecutableFinder.php#L47

However, the is_file(PHP_BINARY) call is only executed in the CLI version of PHP (in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg'))) and open_basedir does not really make sense there.

aschempp commented 6 years ago

Deshalb verwendet der Manager seinen eigenen PhpExecutableFinder weil der aus Symfony ziemlich dumm ist …

temperatur commented 6 years ago

Hi, danke dass ihr euch das Problem anschaut. Bin nur etwas verwirrt. Ist das Problem nun behoben? Soll bei Symfony ein Issue angelegt werden?

Der Fix unter https://gist.github.com/eduardo-g-silva/b094b1576f9d847596e54076327ad415 hat bei der ersten Installation zwar funktioniert. Bereits bei der zweiten von mir aufgesetzten Contao Instanz gab es aber schon Probleme. (Änderungen im PhpExecutableFinder.php wurden nicht übernommen da durch den autoloader er sich die Klasse aus dem contao-manager.phar holte).

Nach ein wenig Suche hab ich auch gesehen das ich im Moment nicht mehr der einzige bin der diese Probleme hat. https://community.contao.org/de/showthread.php?69881-Contao-Manager-open_basedir-restriction-in-effect https://github.com/contao/contao-manager/issues/169 https://github.com/contao/contao-manager/issues/218 All diese Issues sind auf diesen Bug zurückzuführen.

LG

leofeyer commented 6 years ago

Symfony muss das Problem beheben, daher machst Du am besten dort ein Ticket auf.

aschempp commented 6 years ago

Ich bin mir nicht sicher ob Symfony das beheben kann. Der Manager führt ja auch einen expliziten Binary-Pfad, der aber von der Console nicht übernommen wird. Vielleicht müssten wir dem Command eine zusätzliche Option für den Binary-Pfad übergeben? Ist zwar ziemlich umständlich würde aber wohl zumindest im Manager-Kontext funktionieren.

leofeyer commented 6 years ago

Ich bin mir nicht sicher ob Symfony das beheben kann.

Sie haben es schon getan. 😄

https://github.com/symfony/symfony/commit/7a049769bfd8da96ed3015ea170cfe0499f3a201#diff-5d8a4248e9a558ad59118eb63bd01f70

aschempp commented 6 years ago

Nice. Behebt aber nur das Problem wenn die Konstanten vorhanden sind. Leider sind die aus irgendwelchen Gründen auf gewissen Servern deaktiviert.

temperatur commented 6 years ago

Hi, wann werden die Änderungen übernommen. aktuell wird vom Manager (beta17) noch 3.4.6 verwednet brauche aber 3.4.7.

fritzmg commented 6 years ago

aktuell wird vom Manager (beta17) noch 3.4.6 verwednet brauche aber 3.4.7.

Mit dem Contao Manager hat das nichts zu tun.

Symfony 3.4.7 und 3.4.8 sind nicht mit Contao 4.4 kompatibel. Symfony 3.4.7 ist nicht mit Contao 4.4 und 4.5 kompatibel. Um stattdessen Symfony 3.4.8 verwenden zu können musst du entweder auf Contao 4.5 aktualisieren oder warten, bis dass dieses Problem behoben ist.

temperatur commented 6 years ago

Ok, Danke