PHP 5 ha raggiunto la fine del supporto e verrà
ritirato
il 31 gennaio 2026. Dopo il ritiro, non potrai eseguire il deployment di applicazioni PHP 5, anche se la tua organizzazione ha utilizzato in precedenza un criterio dell'organizzazione per riattivare i deployment di runtime legacy. Le tue applicazioni PHP
5 esistenti continueranno a essere eseguite e a ricevere traffico dopo la
data di ritiro. Ti consigliamo di
eseguire la migrazione all'ultima versione supportata di PHP.
File php.ini
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi includere un file php.ini con la tua applicazione App Engine. Questo file consente di personalizzare il comportamento delle direttive dell'interprete PHP.
Informazioni su php.ini
Il file php.ini
deve essere collocato nella directory di base di un'applicazione (la stessa directory del file app.yaml
). Viene caricato quando l'interprete PHP viene inizializzato e prima dell'esecuzione del codice dell'applicazione.
Il file segue la stessa sintassi degli altri file .ini. Un semplice
esempio potrebbe essere:
; This is a simple php.ini file on App Engine
;
; This is a directive set to "On"
widget_compression = "On"
Un elenco delle direttive principali, insieme ai relativi valori di modalità modificabili,
è pubblicato su php.net.
Le direttive php.ini
gestite dalle estensioni sono documentate nelle
rispettive pagine delle estensioni stesse.
Puoi sostituire qualsiasi direttiva PHP che abbia uno dei seguenti valori di modalità modificabili:
PHP_INI_SYSTEM
PHP_INI_ALL
PHP_INI_PERDIR
Tieni presente che alcune funzioni
sono state disabilitate nell'implementazione di PHP in App Engine. Le direttive che hanno come target queste funzioni non avranno alcun effetto.
È possibile attivare un insieme di
estensioni caricabili dinamicamente utilizzando la direttiva extension
.
Istruzioni PHP per App Engine
Le seguenti direttive sono specifiche per l'ambiente App Engine. Possono essere inclusi nel file php.ini.
google_app_engine.enable_curl_lite
-
Se impostato su "1", abilita "cURL lite", una versione di cURL integrata e specifica per App Engine.
"cURL lite" può essere utilizzato esattamente come le funzioni cURL standard, ma sotto il cofano chiama URL Fetch anziché socket, quindi le funzioni senza un equivalente di URL Fetch generano un CurlLiteMethodNotSupportedException
.
Nota: un'app non può attivare contemporaneamente l'estensione "curl.so" e "cURL lite", poiché quest'ultima sovraccarica le funzioni cURL.
google_app_engine.enable_functions
-
Funzioni che sono state disattivate in App Engine, ma che possono essere riattivate utilizzando questa direttiva. Elenca
i nomi delle funzioni in una stringa separata da virgole:
google_app_engine.enable_functions = "phpversion, phpinfo"
google_app_engine.allow_include_gs_buckets
: consente all'applicazione di utilizzare le istruzioni include
o require
con i file archiviati in Google Cloud Storage.
Nota: puoi utilizzare #default#
per il bucket predefinito. Questo valore verrà automaticamente sostituito in fase di esecuzione con il nome del bucket predefinito corrente.
Ad esempio, elenca il bucket predefinito, insieme ai bucket bucket_1
e bucket_2
contenenti i file in una stringa delimitata da virgole:
google_app_engine.allow_include_gs_buckets = "#default#, bucket_1, bucket_2"
Puoi anche specificare un bucket e il percorso dei file che possono essere inclusi, ad esempio:
google_app_engine.allow_include_gs_buckets = "bucket_1/path_x"
Quando viene eseguito il controllo per stabilire quali file possono essere inclusi da Google Cloud Storage, il percorso fornito viene trattato come un prefisso che deve corrispondere all'inizio del nome del file affinché sia incluso o obbligatorio. Ad esempio, utilizzando l'esempio di percorso riportato sopra, il percorso fornito consentirebbe agli utenti di includere i file da gs://bucket_1/path_x/...
perché il prefisso corrisponde, ma non da gs://bucket_1 or gs://bucket_1/path_y/
perché il prefisso non corrisponde.
Se un file caricato viene spostato in un bucket include consentito, viene generato un avviso per segnalare all'utente un potenziale attacco LFI. In questo caso, ti consigliamo di utilizzare un percorso più restrittivo.
Nota: il percorso viene trattato come un prefisso di file, pertanto potrebbe includere anche un file specifico, ad esempio google_app_engine.allow_include_gs_buckets = "bucket_1/path_x.ext", "bucket_2/path_z/some_file.ext
.
google_app_engine.disable_readonly_filesystem
-
Per impostazione predefinita, le applicazioni PHP non sono autorizzate a scrivere nel filesystem.
Se imposti questa direttiva su "1", la limitazione per l'ambiente di sviluppo locale verrà rimossa.
Tuttavia, l'impostazione non si applica alle applicazioni in esecuzione in produzione,
che sono sempre soggette alle limitazioni della sandbox.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-09-04 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ephp.ini\u003c/code\u003e file, placed in the base directory of an App Engine application, allows customization of PHP interpreter directives before application code execution.\u003c/p\u003e\n"],["\u003cp\u003eYou can override PHP directives with changeable mode values such as \u003ccode\u003ePHP_INI_SYSTEM\u003c/code\u003e, \u003ccode\u003ePHP_INI_ALL\u003c/code\u003e, and \u003ccode\u003ePHP_INI_PERDIR\u003c/code\u003e, excluding those targeting disabled functions.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine provides specific directives within \u003ccode\u003ephp.ini\u003c/code\u003e, including \u003ccode\u003egoogle_app_engine.enable_curl_lite\u003c/code\u003e to use "cURL lite," and \u003ccode\u003egoogle_app_engine.enable_functions\u003c/code\u003e to re-enable certain soft-disabled functions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle_app_engine.allow_include_gs_buckets\u003c/code\u003e directive permits the use of \u003ccode\u003einclude\u003c/code\u003e or \u003ccode\u003erequire\u003c/code\u003e statements with files stored in specified Google Cloud Storage buckets, with path prefix matching.\u003c/p\u003e\n"],["\u003cp\u003eIn local development, \u003ccode\u003egoogle_app_engine.disable_readonly_filesystem\u003c/code\u003e can be set to "1" to allow filesystem writing, but this is not applicable in production due to sandbox restrictions.\u003c/p\u003e\n"]]],[],null,["You can include a php.ini file with your App Engine application. This file\nlets you customize the behavior of the PHP interpreter directives.\n\nAbout php.ini\n\nThe `php.ini` file should be\nplaced in the base directory of an application (the same directory as the\n`app.yaml` file). It is loaded when the PHP interpreter is\ninitialized, and before your application code is run.\n\nThe file follows the same syntax as\n[other .ini files](https://en.wikipedia.org/wiki/INI_file). A simple\nexample might look like: \n\n```php\n; This is a simple php.ini file on App Engine\n;\n; This is a directive set to \"On\"\nwidget_compression = \"On\"\n```\n\nA list of the core directives, along with their changeable mode values,\n[is published on php.net](http://www.php.net/manual/en/ini.list.php).\nThe `php.ini` directives handled by extensions are documented on the\nrespective pages of the extensions themselves.\n\nYou may override any PHP directive that has one of the following changeable mode values:\n\n- `PHP_INI_SYSTEM`\n- `PHP_INI_ALL`\n- `PHP_INI_PERDIR`\n\nNote that some functions\n[have been\ndisabled in the App Engine implementation of PHP](/appengine/docs/legacy/standard/php/runtime#disabled_functions). Directives that target\nthese functions will have no effect.\n\nA set of [dynamically loadable extensions](/appengine/docs/legacy/standard/php/runtime#dynamically_loadable_extensions) can be enabled using the\n`extension` directive.\n\nPHP Directives for App Engine\n\nThe following directives are specific to the App Engine environment. They can\nbe included in the php.ini file.\n\n- **`google_app_engine.enable_curl_lite`** - Enables \"cURL lite\", a built-in, App Engine-specific version of cURL, when set to \"1\". \"cURL lite\" can be used exactly as you would use the standard [cURL functions](http://php.net/manual/en/ref.curl.php), but it calls [URL Fetch](/appengine/docs/legacy/standard/php/issue-requests) under the hood rather than sockets, thus functions with no URL Fetch equivalent, throw a `CurlLiteMethodNotSupportedException`.\n\n Note: An app can't enable the \"curl.so\" extension and \"cURL lite\" at the same time,\n as the latter overloads the cURL functions.\n- **`google_app_engine.enable_functions`** - Functions that have been [soft\n disabled](/appengine/docs/legacy/standard/php/runtime#functions_that_can_be_manually_enabled) in App Engine, but can be re-enabled using this directive. List the function names in a comma delimited string: \n\n ```\n google_app_engine.enable_functions = \"phpversion, phpinfo\"\n ```\n- **`google_app_engine.allow_include_gs_buckets`** - Allows your application to use the [`include`](http://php.net/manual/en/function.include.php) or [`require`](http://us1.php.net/manual/en/function.require.php) statements with files stored in [Google Cloud\n Storage](/appengine/docs/legacy/standard/php/googlestorage).\n\n \u003cbr /\u003e\n\n Note: You can use `#default#` for the default bucket; this value\n will be automatically replaced at runtime with your current default bucket name.\n\n For example, list the default bucket, along with buckets `bucket_1` and `bucket_2`\n containing the files in a comma delimited string: \n\n ```\n google_app_engine.allow_include_gs_buckets = \"#default#, bucket_1, bucket_2\"\n ```\n\n You can also specify a bucket and path to files that can be included, for example: \n\n ```\n google_app_engine.allow_include_gs_buckets = \"bucket_1/path_x\"\n ```\n\n When the check is performed for which files may be included from Google Cloud Storage, the\n supplied path is treated as a prefix that must match the start of the file name in order for it\n to be included or required. For example using the path example above, the supplied\n path would allow users to include files from `gs://bucket_1/path_x/...`\n because the prefix matches but not from `gs://bucket_1 or gs://bucket_1/path_y/` because\n the prefix doesn't match.\n\n If an uploaded file is moved to an allowed include bucket, a warning\n is generated to alert the user to a potential\n [LFI](https://en.wikipedia.org/wiki/File_inclusion_vulnerability)\n attack. If this happens, you should consider using a more\n restrictive path.\n\n **Note:** the path is treated as a file\n prefix; so it could include a specific file\n as well, for example, `google_app_engine.allow_include_gs_buckets = \"bucket_1/path_x.ext\", \"bucket_2/path_z/some_file.ext`.\n- **`google_app_engine.disable_readonly_filesystem`** - By default PHP applications are not allowed to write to the filesystem. Setting this directive to \"1\" will lift the restriction for the local development environment. However, the setting does not apply to applications running in production, which are always subjected to the [sandbox restrictions](/appengine/docs/legacy/standard/php/runtime#the_sandbox)."]]