Task #35916

Make system call to php binary reliable one for all, especially on Windows

Added by Adrian Föder over 9 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Should have
Category:
Core
Start date:
2012-04-12
Due date:
% Done:

100%

Estimated time:
Sprint:
PHP Version:
Has patch:
No
Complexity:

Description

Currently, there are still issues with \TYPO3\FLOW3\Core\Booting\Scripts'

            $phpBinaryPathAndFilename = escapeshellcmd(\TYPO3\FLOW3\Utility\Files::getUnixStylePath($settings['core']['phpBinaryPathAndFilename']));
            $command = '"' . $phpBinaryPathAndFilename . '" -c ' . escapeshellarg(php_ini_loaded_file()) . ' -v';
            system($command, $result);
            if ($result !== 0) {
                throw new \TYPO3\FLOW3\Exception('It seems like the PHP binary "' . $settings['core']['phpBinaryPathAndFilename'] . '" cannot be executed by FLOW3. Set the correct path to the PHP executable in Configuration/Settings.yaml, setting FLOW3.core.phpBinaryPathAndFilename.', 1315561483);
            }
            throw new \TYPO3\FLOW3\Exception('The compile run failed. Please check the error output or system log for more information.', 1297263663);

Its very likely that this call still doesn't success in complicated Windows environment, where the path is e.g. set to C:\Program Files (x86)\Zend\ZendServer\bin\php.exe. Even that escapeshellcmd brings up errors because the (x86) is converted to ^(x86^).

Additionally, the exception message should be more verbose and at least carry the actual $command in order to make error catching more easy.
A few additional file_exists and other stuff may also make that stuff more reliable.

Also available in: Atom PDF