dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.68k stars 221 forks source link

Creating a Laravel project fails, probably because FrankenPHP doesn't support -r flag #945

Open hkockerbeck opened 1 month ago

hkockerbeck commented 1 month ago

What happened?

When I try to create a new Laravel project with

 ./composer create-project laravel/laravel laraveltest

it fails with

> @php -r "file_exists('.env') || copy('.env.example', '.env');"

Warning: Unknown: Failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Failed opening required '-r' (include_path='.:') in Unknown on line 0
Script @php -r "file_exists('.env') || copy('.env.example', '.env');" handling the post-root-package-install event returned with error code 255

The helper script composer is in the same directory and looks like this

#!/bin/bash
exec ./frankenphp-linux-x86_64 php-cli ./composer.phar $@

It looks like (at least) one step in creating the project tries to use php -r to execute PHP code without a file. As far as I can tell, FrankenPHP doesn't support the -r flag yet. Some experiments underpin that

php -r "echo 'Hello';" # on a "regular" PHP installation, correctly prints 'Hello'

# compared with 

./frankenphp-linux-x86_64 php-cli -r "echo 'Hello';"

Warning: Unknown: Failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Failed opening required '-r' (include_path='.:') in Unknown on line 0

Build Type

Standalone binary

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

Not applicable, we don't get that far ;)

Relevant log output

No response

dunglas commented 1 month ago

Indeed, -r isn't supported yet.