PHP Extensions Not Installing via Railpack Configuration
4abduu
FREEOP

5 days ago

Hello,

I'm trying to add PHP extensions (gd, bz2, intl, exif, xsl, zip) to my Laravel backend service deployed on Railway, but none of the standard configuration methods are working.

What I've tried:

Using nixpacks.toml with extensions array:

[providers.php]

extensions = ["bz2", "curl", "fileinfo", "gd", "intl", "mbstring", "exif", "mysqli", "pdo_mysql", "pdo_sqlite", "sqlite3", "xsl", "zip"]

Result: Extensions not installed. Build log shows Railpack using default extensions only.

Using environment variable NIXPACKS_PHP_EXTENSIONS: Set the variable in Railway dashboard with all required extensions. Result: No effect. Railpack ignores this variable.

Creating railpack.toml with same extensions array: Result: File is ignored. Same default extensions installed.

Current situation:

Build system: Railpack v0.23.0

PHP version: 8.2.31

Only these extensions are installed: ctype, curl, dom, fileinfo, filter, hash, mbstring, openssl, pcre, pdo, session, tokenizer, xml, pdo_mysql

Missing: gd, bz2, intl, exif, xsl, zip

Build log shows:

install-php-extensions ctype curl dom fileinfo filter hash mbstring openssl pcre pdo session tokenizer xml pdo_mysql

It appears Railpack is not reading any configuration files for PHP extensions. How should I properly configure PHP extensions in Railpack? Do I need to use a custom Dockerfile instead?

Thank you for your help.

Screenshot_2026-05-27_192224.png

Attachments

Solved

11 Replies

4abduu
FREEOP

5 days ago

Hello,

Following up on my previous ticket regarding the PHP GD extension installation, I have a few more questions regarding container behavior and running background processes on Railway.

I'm currently hosting a Laravel backend application here, and I ran into a weird issue with our "Forgot PIN/OTP" feature. When users request an OTP from the frontend, it often fails or doesn't process correctly. However, when I manually run railway run php artisan config:clear and cache:clear via the Railway CLI, the exact same request suddenly works perfectly.

It seems like the container configuration or state is heavily cached, causing the application to stall on handling these runtime states until a manual cache clear is triggered.

Additionally, as this project scales, I need to run Laravel Reverb (Websockets) and a Queue Worker (if needed for otp) (php artisan queue:work) which both require persistent daemon processes running 24/7 in the background.

Could you give me some guidance on:

  1. How can I prevent this configuration caching issue during runtime? Is there a specific setup I should tweak in my railway.json or deployment settings?
  2. What is the best practice or recommended approach on Railway to run persistent terminal commands like php artisan reverb:start and php artisan queue:work alongside the main web server? Do I need to set up separate services or use a specific process manager within the same container?

Looking forward to your guidance on the GD extension, the OTP caching issue, and the background workers. Thank you!


5 days ago

Hey! a lot of things going on here...


5 days ago

About PHP extensions first, you're using Railpack, so Nixpacks configurations won't apply as they're entirely different builders and Nixpacks is deprecated.

Have you tried setting a RAILPACK_PHP_EXTENSIONS env var? It also reads extensions from composer.json

See the docs: https://railpack.com/languages/php#php-extensions


5 days ago

Now about your other issue, railway run runs locally, on your machine, does it send the PIN/OTP via email? Because to be able to use SMTP port on Railway you need to be on the Pro plan or above.

See: https://docs.railway.com/networking/outbound-networking#email-delivery


4abduu
FREEOP

5 days ago

Thanks for the info Medim! That answers my SMTP and PHP extension question — PHP extension already installed, and i'll need to use an HTTP-based email API instead.

Following up on that, do you have any recommendations for a transactional email service that:

  • Works via HTTP API (not SMTP) so it works on Railway free plan
  • Can send to any recipient without requiring custom domain verification
  • Has a free tier suitable for a student project
  • Allows a non-personal sender address

I tried Resend but it only allows sending to my own registered email without domain verification. Is there a service you'd recommend that doesn't have this restriction?


4abduu
FREEOP

5 days ago

*note: please tag me once it's been answered


4 days ago

@Abduuu. Maybe piisend.com? I've never used their services though.


4abduu
FREEOP

4 days ago

Oh, okay then. I’ll try it tomorrow. If it still doesn’t work, do I have to get the Pro Plan for $20 to use the SMTP service? I’m also using a Google app password for the SMTP


4 days ago

Yeah, you would need to upgrade to the Pro plan and redeploy your services.


iloveitaly
HOBBY

3 days ago

resend.com is great


4abduu
FREEOP

2 days ago

Thank you all for your help. I’ve decided to purchase a domain name and use the Resend service.


Status changed to Solved medim 2 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...