herd-community
herd-community copied to clipboard
[Bug]: Connection to SFTP server via phpseclib causes segmentation fault
Platform
macOS
Operating system version
macOS Sonoma 14.6.1 (23G93)
System architecture
Intel (x86)
Herd Version
1.11.2 (Build: 35)
PHP Version
No response
Bug description
Hello guys, I'm trying to connect to a SFTP server via the Laravel storage facade. The storage facade uses Flysystem, which itself uses the phpseclib package. I use the following versions:
laravel/framework 11.27.2 league/flysystem-sftp-v3 3.29.0 phpseclib/phpseclib 3.0.42
When I am trying to connect to the server I get a segmentation fault.
I have tested PHP 8.2.25, PHP 8.3.13 and 8.4.0RC3. On the CLI a get the segmentation fault and with FPM I get a 502 Bad Gateway.
I also tested PHP 8.3.12 (cli) from Brew. With the Brew built everything works as expected.
Steps to reproduce
$sftp = new \phpseclib3\Net\SFTP('host');
$sftp->login('user', 'pass');
Relevant log output
> php artisan sftp
zsh: segmentation fault
I just asked a co-worker to run my code with the apple silicon build. The silicon build has no problems with the phpseclib library.
Versions:
PHP 8.3 (8.3.12) Herd 1.11.2 Sonoma 14.5
The latest static-php-cli macOS x86_64 build looks good to me though. II'm not sure if there are any issues with Herd yet, need @mpociot to confirm this.
I don't have an Intel Mac, but if there is a direct link to the PHP binary that Herd uses, I could download one for testing with rosetta.
Hey @crazywhalecc, thanks for having an eye on this issue. Unfortunately, I can't help out with testing either. I changed my intel mac against an apple silicon mac recently.
Is there a fix coming for this? I'm still running an Intel mac, and the SFTP adapter does not work.
Is there a fix coming for this? I'm still running an Intel mac, and the SFTP adapter does not work.
@jeffgreco13 It would be great if you could upload your local intel version of PHP binary to me. And I would be able to debug.
@jeffgreco13 It would be great if you could upload your local intel version of PHP binary to me. And I would be able to debug.
PHP Version 8.4.10
Darwin MacBookPro 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:17 PDT 2025; root:xnu-11417.140.69~1/RELEASE_X86_64 x86_64
A few additional notes: I am using a freshly reformatted Intel Mac with a brand new install of Herd (Pro version). I deployed the code to a standard DigitalOcean server on Forge - no additional packages installed, just the default installation.
After full testing for static-php and Herd, this issue has been fixed in static-php-cli 2.6.1 and later versions, but the static-php-cli builder used by Herd is still 2.5.0. @mpociot may need to update it.
This should now be fixed in the latest updates