expose
expose copied to clipboard
Forge: `Failed to open stream: phar error: invalid url or non-existent phar sqlite-worker.php`
Hello,
I'm trying to setup a Expose on one of my Forge servers so I can use a custom domain. However, when I attempt to run the expose serve expose.mydomain.com command, I get this error:
PHP Warning: require(phar:///home/forge/.config/composer/vendor/beyondcode/expose/builds/expose/vendor/clue/reactphp-sqlite/res/sqlite-worker.php): Failed to open stream: phar error: invalid url or non-existent phar "phar:///home/forge/.config/composer/vendor/beyondcode/expose/builds/expose/vendor/clue/reactphp-sqlite/res/sqlite-worker.php" in Command line code on line 1
The same error continues a few times if I try and share from my laptop or try and use the Expose admin interface. I couldn't really find anything specific on Google or in the existing GH Issues for this particular error.
I've tried nuking my composer.lock and vendor directory, then reinstalling in case that makes a difference, but nope. (it's installed globally)
Config
Only made two changes:
- Updated the admin database path:
/*
|--------------------------------------------------------------------------
| Database
|--------------------------------------------------------------------------
|
| The SQLite database that your expose server should use. This database
| will hold all users that are able to authenticate with your server,
| if you enable authentication token validation.
|
*/
// 'database' => implode(DIRECTORY_SEPARATOR, [
// $_SERVER['HOME'] ?? __DIR__,
// '.expose',
// 'expose.db',
// ]),
'database' => '/home/forge/.expose/expose.db',
- Setup a user for Expose admin access
Versions
I'm using Expose 2.1 and PHP 8.1 both on the server and locally.
Thanks for opening this issue. I've updated the react-sqlite dependency as it should've solved this issue (I was using a fork before making this change). Unfortunately it seems like this issue is not getting caught by our test cases as well as my manual tests.
I'll revert the dependency and tag a new version 2.1.1
Thanks for your quick response! I'll wait for 2.1.1 :)
Also, just tested the PHAR download but it obviously has the same issue.
Thanks for reporting this also here! It looks like you'll enjoy this: https://github.com/clue/reactphp-sqlite/pull/61 and https://twitter.com/another_clue/status/1492922796565012481
The gist is that PHP exhibits some undocumented behavior when accessing files within a PHAR archive that does not have a file extension (the expose binary). Interestingly, the exact same code works just fine when the same file is called expose.phar or expose.anything.
I've been working on this for the last few days and have now solved this upstream in clue/reactphp-sqlite. In particular, this includes a number of relevant test cases to confirm this works across all supported platforms, including Windows (which requires some special care).
I hope to get the next version of clue/reactphp-sqlite shipped today :shipit: Glad to have a number of sponsors that allow me to work on nasty issues like this! ❤️ Once the dependency is updated, there should be no changes required on your end. Enjoy!
Thank you for your hard work on this @clue - happy to sponsor you 🙂
Thank you for your hard work on this @clue - happy to sponsor you :slightly_smiling_face:
Thank you @mpociot, very much appreciated! ❤️
A new upstream package version has just been released: https://github.com/clue/reactphp-sqlite/releases/tag/v1.5.0
This is part three of a larger effort to address a rather nasty, undocumented PHP behavior and should finally solve this issue. Please report back if this solves this for you as well.
@mpociot Sorry to bother you, is there any way I can help to get this issue fixed?
Got Expose to work for now but only if I run it as PHP 8.0.