PHP 5 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、PHP 5 アプリケーションをデプロイできなくなります。既存の PHP 5 アプリケーションは、
非推奨になる日付以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの PHP に移行することをおすすめします。
設定
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
PHP 5 アプリには、適切な Google Cloud Storage バケットを構成する必要があります。次の操作を行うと、アプリがこのようなバケットに簡単にアクセスできるようになります。
- まだ行っていない場合は、プロジェクトで課金を有効にします。
- プロジェクトの Storage ブラウザで、[バケットを作成] をクリックします。
Cloud Storage バケットを使用すると、費用が発生する可能性があります。各プロジェクトにはデフォルトのバケットがあり、5GB の無料ストレージと I/O オペレーションの無料割り当てが設定されています。
デフォルトのバケットを使用する場合のヒント
デフォルトのバケットを使用する場合、#default#
を使用すると、ランタイム時に、この値がデフォルトのバケット名に置き換えられます。そのため、バケット名を把握しておく必要はありません。
たとえば、App Engine で Cloud Storage ストリーム ラッパーを使用してデフォルトのバケットに書き込みます。
または
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eThis API supports first-generation runtimes and can be used when upgrading to corresponding second-generation runtimes.\u003c/p\u003e\n"],["\u003cp\u003ePHP 5 apps require a configured Google Cloud Storage bucket, accessible by enabling billing and creating a bucket in the Storage Browser.\u003c/p\u003e\n"],["\u003cp\u003eEach project has a default bucket that includes 5GB of free storage and a free quota for I/O operations, which might incur additional costs.\u003c/p\u003e\n"],["\u003cp\u003eWhen using a default bucket, you can use \u003ccode\u003e#default#\u003c/code\u003e in place of the bucket name, which will be replaced at runtime, or find it programmatically with \u003ccode\u003eCloudStorageTools::getDefaultGoogleStorageBucketName()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can write to the default bucket using the App Engine stream wrapper, which will leverage functions such as \u003ccode\u003efile_put_contents\u003c/code\u003e and \u003ccode\u003efwrite\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Setup\n\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| php-gen2\n|\n| /services/access). If you are updating to the App Engine PHP 7/8 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/php-differences) to learn about your migration options for legacy bundled services.\n\n\u003cbr /\u003e\n\nYour PHP 5 app requires a properly configured Google Cloud Storage\nbucket. Fortunately, each app can easily gain access to such a bucket if you do\nthe following:\n\n1. [Enable billing](https://console.cloud.google.com/billing) for your project, if you haven't already done so.\n2. Click **Create bucket** in the [Storage Browser](https://console.cloud.google.com/storage/browser) for your project.\n\nNote you might incur costs by using a Cloud Storage bucket. Each project can\nhave a default bucket, which includes\n[5GB of free storage and a free quota for I/O operations](/appengine/docs/quotas#Default_Gcs_Bucket).\n\n### Useful tricks when using default buckets\n\nWhen using a default bucket, you don't actually need to know your bucket name:\nyou can use `#default#` and this will be replaced at runtime by the name of the default bucket.\n| **Note:** The default bucket name is typically `\u003capp_id\u003e.appspot.com`, where `\u003capp_id\u003e` is your app ID. You can find the bucket name in the App Engine Admin console **Application Settings** page, under the label *Google Cloud Storage Bucket* . Alternatively, if you don't want to use `#default#`, you can use the [CloudStorageTools::getDefaultGoogleStorageBucketName()](/appengine/docs/legacy/standard/php/refdocs/classes/google.appengine.api.cloud_storage.CloudStorageTools#method_getDefaultGoogleStorageBucketName) method to find the name programmatically.\n\nFor example, you would write to the default bucket using the App Engine\nstream wrapper for Cloud Storage: \n\n $default_bucket = CloudStorageTools::getDefaultGoogleStorageBucketName();\n file_put_contents(\"gs://${default_bucket}/hello_default.txt\", $newFileContent);\n\nor \n\n $default_bucket = CloudStorageTools::getDefaultGoogleStorageBucketName();\n $fp = fopen(\"gs://${default_bucket}/hello_default_stream.txt\", 'w');\n fwrite($fp, $newFileContent);\n fclose($fp);"]]