Wrong PHP version during build
pkcrazy
HOBBYOP

a month ago

Hello guys!

I'm trying to build a Laravel project with PHP 8.5 but the build uses PHP 8.3.30.

In composer.json I configured php "^8.5".

The agent suggested to set the RAILPACK_PHP_VERSION to 8.4, however, it's an 8.5 project so I set it to 8.5 with no success. Then I checked the docs for that environment variable and found nothing.

What am I doing wrong?

$10 Bounty

5 Replies

Railway
BOT

a month ago

PHP 8.5 is not yet a stable release (it is currently in development, with a general availability target of November 2025), so Railpack does not have it available and falls back to the latest supported stable version. You can set the RAILPACK_PHP_VERSION environment variable to 8.4 to use the latest stable PHP, or use a custom Dockerfile with a PHP 8.5 development image if you specifically need 8.5 pre-release builds.


Status changed to Awaiting User Response Railway 29 days ago


Status changed to Awaiting Railway Response Railway 29 days ago


Status changed to Open Railway 28 days ago


domehane
FREE

a month ago

Hello pkcrazy,

can you share your full composer.json and your build logs?


pkcrazy
HOBBYOP

a month ago

composer.json:

{ "$schema": "https://getcomposer.org/schema.json", "name": "laravel/livewire-starter-kit", "type": "project", "description": "The official Laravel starter kit for Livewire.", "keywords": [ "laravel", "framework" ], "license": "MIT", "require": { "php": "^8.5", "laravel/fortify": "^1.34", "laravel/framework": "^13.0", "laravel/tinker": "^3.0", "livewire/flux": "^2.13", "livewire/flux-pro": "^2.13", "livewire/livewire": "^4.1" }, "require-dev": { "fakerphp/faker": "^1.24", "laravel/boost": "^2.0", "laravel/pail": "^1.2.5", "laravel/pint": "^1.27", "laravel/sail": "^1.53", "mockery/mockery": "^1.6", "nunomaduro/collision": "^8.9", "pestphp/pest": "^4.4", "pestphp/pest-plugin-laravel": "^4.1" }, "autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "scripts": { "setup": [ "composer install", "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"", "@php artisan key:generate", "@php artisan migrate --force", "npm install", "npm run build" ], "dev": [ "Composer\\Config::disableProcessTimeout", "npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others" ], "lint": [ "pint --parallel" ], "lint:check": [ "pint --parallel --test" ], "ci:check": [ "Composer\\Config::disableProcessTimeout", "@test" ], "test": [ "@php artisan config:clear --ansi", "@lint:check", "@php artisan test" ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-update-cmd": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force", "@php artisan boost:update --ansi" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi", "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"", "@php artisan migrate --graceful --ansi" ], "pre-package-uninstall": [ "Illuminate\\Foundation\\ComposerScripts::prePackageUninstall" ] }, "extra": { "laravel": { "dont-discover": [] } }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, "allow-plugins": { "pestphp/pest-plugin": true, "php-http/discovery": true } }, "minimum-stability": "stable", "prefer-stable": true, "repositories": [{ "name": "flux-pro", "type": "composer", "url": "https://composer.fluxui.dev" }] }

And the build log:

Composer plugins have been disabled for safety in this non-interactive session.
Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.
Do not run Composer as root/super user! See https://getcomposer.org/root for details

Installing dependencies from lock file (including require-dev)

Verifying lock file contents can be installed on current platform.

Your lock file does not contain a compatible set of packages. Please run composer update.


  Problem 1
    - symfony/clock is locked to version v8.0.0 and an update of this package was not requested.
    - symfony/clock v8.0.0 requires php >=8.4 -> your php version (8.3.30) does not satisfy that requirement.
  Problem 2
    - symfony/console is locked to version v8.0.7 and an update of this package was not requested.
    - symfony/console v8.0.7 requires php >=8.4 -> your php version (8.3.30) does not satisfy that requirement.
  Problem 3
    - symfony/css-selector is locked to version v8.0.6 and an update of this package was not requested.
    - symfony/css-selector v8.0.6 requires php >=8.4 -> your php version (8.3.30) does not satisfy that requirement.
  Problem 4
    - symfony/error-handler is locked to version v8.0.4 and an update of this package was not requested.
    - symfony/error-handler v8.0.4 requires php >=8.4 -> your php version (8.3.30) does not satisfy that requirement.
  Problem 5
    - symfony/event-disp

There is no RAILPACK_PHP_VERSION variable. Railpack reads your composer.json to determine the PHP version, or it defaults to version 8.4.

The version 8.5 might not be available in Railpack currently as the Railway bot said.

I suggest you remove RAILPACK_PHP_VERSION , as it's a no-op variable, and use version 8.4 instead. If you have to use 8.5 , you can always switch to a Dockerfile setup to pull whatever version you want.

You can read more about this in the Railpack docs: https://railpack.com/languages/php/


domehane
FREE

a month ago

Hy again,

so railpack doesn't have a RAILPACK_PHP_VERSION variable that's why it's not working and the way railpack picks the php version is by reading your composer.json directly, so since you already have "php": "^8.5" in there, the issue is likely that php 8.5 isn't available yet in railpack's build environment

try adding a mise.toml file at the root of your project with this:

toml

[tools]
php = "8.5"

railpack detects mise.toml automatically and uses it during the build give that a shot and let me know if it works


Welcome!

Sign in to your Railway account to join the conversation.

Loading...