0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VPS(本番環境)にマージしたらintlがなくてページが表示できなくなった

0
Last updated at Posted at 2026-02-08

目的

VPS(本番環境に)にgitのリモートからマージしてページを表示させたい

環境

OS : Ubuntu24.04(さくらVPS)
docker
laravel : laravel12
php : php8.2

起きたエラー

VPS内で、リモートからgit pullして公開してるlaravelアプリにアクセスしたら
このページは動作していません HTTP ERROR 500
が出てきた

laravelのログを確認する

VPS内のコンテナに入る

docker exec -it app bash

laravelのログを確認する
cat storage/logs/laravel.log | tail -n 50

ログのメッセージ
RuntimeException: The "intl" PHP extension is required to use the [format] method.

Target class [view] does not exist.

直接的なエラーは
RuntimeException: The "intl" PHP extension is required to use the [format] method.
が原因

PHPの拡張機能intlが本番サーバーにインストールされていないということらしい

intlとは

国際化用拡張モジュール (これ以降では Intl と略します) は » ICU ライブラリのラッパーです。 PHP プログラマが、ロケール関連のさまざまな操作を行えるようにします。 フォーマット、音訳、エンコード変換、カレンダーの処理、 » UCA 準拠の照合順序 (collation)、 テキストの区切り、ロケール識別子やタイムゾーンや書記素を用いた操作などが可能です。

Target class [view] does not exist.
これはintlがないことによってlaravelの起動が途中で止まってしまい、画面表示をするためのViewサービスの準備が完了しなかった

解決策

1. intlのインストール

dockerコンテナ内でphpにintlを追加

apt-get update
apt-get install -y libicu-dev
docker-php-ext-install intl

2. 設定の反映

phpのプロセスに新しい拡張機能を認識させるためコンテナを再起動

docker compose restart 

3. 本番環境の最適化

なんかいい感じに最適化する

php artisan optimize

再発防止策

このままだとイメージをビルドしなおしたときにintlがまた消えてしまうので、Dockerfileにintlをインストールするコマンドを追加しておく

docker/php/Dockerfileに以下を追加

RUN apt-get update && apt-get install -y libicu-dev \
    && docker-php-ext-install intl

これで本番サーバーにマージしてもページちゃんと表示してくれるはず

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?