Phar symfony 6.4
Opened this issue · 5 comments
Bug report
Question | Answer |
---|---|
Box version | 29c3585 |
PHP version | 8.3.6 |
Platform with version | linux 22 |
Github Repo |
Hello everyone, I have an anomaly with box when I try the box compile command. Indeed when I launch the application, php returns me the following error: PHP Warning: require(phar:///var/www/html/pictav.phar/src/config/bundles.php): Failed to open stream: phar error: "src/config/bundles.php" is not a file in phar "/var/www/html/pictav.phar" .
However in the new version of symfony, the bundles.php file is located at the root of the config folder and not in src. Can you help me?
No visible error during the PHP archiving process, the error is only when launching the application, which tries to open the bundle from the src folder each time. I tried to find solutions with the Symfony doc, but I found nothing.
Thank you in advance for your help
box.json.dist
{
"main": "public/index.php",
"output": "pictav.phar",
"directories": [
"bin",
"config",
"public",
"src",
"templates",
"var",
"vendor"
],
"files": [
".env",
".env.local",
"composer.json",
"composer.lock",
"symfony.lock"
],
"stub": true,
"compression": "GZ",
"check-requirements": false
}
Output
$ command
> box compil
However in the new version of symfony, the bundles.php file is located at the root of the config folder and not in src. Can you help me?
But then how is calling this path?
You can check if the files you are expecting are shipped first, e.g. if the bundle.php
file is there (if your IDE does not index PHARs, you can either use box info
or extract it in a temporary directory).
Otherwise my guess is that the Kernel tries to guess the path but does not manage to: https://box-project.github.io/box/symfony/#project-directory
If you read the error message it shows that you are missing the : string
type return that appears to be now enforced. Looks like the docs need to be updated.
I don't know the structure of your project so you need to adapt it based on that, I do not know if _DIR_.'/../'
is the correct value; but your console app (not the PHAR) should still work after this change so it is easy to check (from the current error you have, I am pretty sure that doing a bin/console
will just fail too).
I also tried moving the folder in the Json so that the config folder would be called first. No improvement.
I do not understand that statement, which JSON? what config folder would be called?
There is otherwise a working example within Box itself otherwise https://github.com/box-project/box/tree/main/fixtures/build/dir012.
Thank you very much for your help, it works. I just have this information on my front showing: #!/usr/bin/env php .
I'll take a closer look at what's causing this.
if you're rendering it as a web app, I have no clue if that works at all. There is a ton of settings for serving a web PHAR which I have no clue how it works and IMO it is a very edge case (e.g. to deploy on an FTP server), hence there is no native support within Box for it. Could be it happens to work, but could be you need to adjust a few things yourself, I honestly have no idea.