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.
Utilizzo di Cloud Firestore in modalità Datastore
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Firestore è un database di documenti NoSQL creato per offrire scalabilità automatica,
prestazioni elevate e facilità di sviluppo delle applicazioni. È la versione più recente di Datastore e introduce diversi miglioramenti rispetto a Datastore.
Poiché Firestore in modalità Datastore è ottimizzato per i casi d'uso dei server e per App Engine, consigliamo di utilizzare Firestore in modalità Datastore per i database che verranno utilizzati principalmente dalle app App Engine. Firestore in modalità Native è più utile per i casi d'uso di notifiche mobile e in tempo reale. Per ulteriori informazioni sulle modalità Firestore, consulta la sezione Scegliere tra la modalità Native e la modalità Datastore.
Utilizzo della modalità Datastore con App Engine
Per utilizzare la modalità Datastore con App Engine:
Se non l'hai ancora fatto,
crea un database
e scegli Firestore in modalità Datastore.
Puoi utilizzare i database Datastore esistenti con le app App Engine. Per questi database esistenti verrà eseguito automaticamente l'upgrade a Firestore in modalità Datastore.
Nell'app, dichiara Datastore come dipendenza
aggiungendo google/cloud-datastore
al file composer.json
dell'app ed eseguendo
composer install
dalla directory dell'app. Scopri di più su
composer.
Utilizza la libreria client Google Cloud per leggere e scrivere entità e per eseguire query sui dati.
Configurazione degli indici
La modalità Datastore utilizza
indici
per ogni query eseguita dalla tua applicazione. Gli indici vengono aggiornati ogni volta che un'entità cambia, in modo che i risultati possano essere restituiti rapidamente quando l'app esegue una query.
La modalità Datastore crea automaticamente indici a proprietà singola da utilizzare con tipi di query semplici. Per query complesse che includono più proprietà,
devi configurare gli indici composti nel file index.yaml
dell'app.
Il server di sviluppo App Engine aggiornerà il file index.yaml
con gli indici composti necessari per eseguire i test. Analogamente, l'emulatore della modalità Datastore può generare indici quando esegui i test.
Puoi anche aggiungere gli indici al file index.yaml
della tua app manualmente se non esegui test locali o se i tuoi test non includono query complesse.
Impostazione delle autorizzazioni di accesso al database
Per impostazione predefinita, l'app dispone di tutte le autorizzazioni necessarie per leggere e scrivere nei database in modalità Datastore e Firestore del progettoGoogle Cloud .
Per gestire queste autorizzazioni, ogni app App Engine utilizza un account di servizio predefinito che concede l'accesso in lettura e scrittura completo alla modalità Datastore e ai database Firestore nello stesso progetto dell'app. Puoi modificare le autorizzazioni dell'account di servizio predefinito, ma la tua app potrebbe perdere l'accesso a meno che non assegni un ruolo IAM con le autorizzazioni richieste.
Per informazioni su come consentire ad altri utenti, app o progetti di accedere a un database, consulta
Accedere al database.
Utilizzo dell'emulatore in modalità Datastore per i test locali
Google Cloud CLI include un emulatore locale dell'ambiente di produzione con modalità Datastore.
Puoi utilizzare l'emulatore per sviluppare e testare l'applicazione localmente. Inoltre, l'emulatore può aiutarti a generare indici per l'istanza in produzione in modalità Datastore ed eliminare gli indici non necessari.
Se utilizzi il server di sviluppo locale di App Engine per testare la tua app, puoi assicurarti che il server utilizzi l'emulatore della modalità Datastore impostando il flag --support_datastore_emulator=true
all'avvio del server.
Se utilizzi l'emulatore in modalità Datastore, dev_appserver mostrerà:
... Using Cloud Datastore Emulator.
Prezzi, quote e limiti
La modalità Datastore offre una quota gratuita con limiti giornalieri. Gli account pagati offrono operazioni di lettura, scrittura e spazio di archiviazione illimitati. Ulteriori informazioni sono disponibili nella pagina Quote di Datastore.
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\u003eFirestore, an upgraded version of Datastore, is a NoSQL document database designed for automatic scaling, high performance, and straightforward application development, offering both Native mode and Datastore mode.\u003c/p\u003e\n"],["\u003cp\u003eFirestore in Datastore mode is recommended for App Engine applications, while Native mode is better suited for mobile and real-time notification use cases, with existing Datastore databases automatically upgrading to this mode.\u003c/p\u003e\n"],["\u003cp\u003eDatastore mode relies on indexes for all application queries, with automatic creation for single-property indexes and manual or emulator-assisted creation for complex composite indexes in the \u003ccode\u003eindex.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine apps have default service account permissions for Datastore mode and Firestore databases within the same Google Cloud project, though permissions can be adjusted via IAM roles.\u003c/p\u003e\n"],["\u003cp\u003eThe Datastore mode emulator, part of the Google Cloud CLI, allows for local development and testing, including index generation and deletion, and can be used in conjunction with the App Engine local development server.\u003c/p\u003e\n"]]],[],null,["# Using Cloud Firestore in Datastore Mode\n\nFirestore is a NoSQL document database built for automatic scaling,\nhigh performance, and ease of application development. It is the newest version\nof Datastore and introduces several improvements over\nDatastore.\n\nBecause Firestore in [Datastore mode](/datastore/docs)\nis optimized for server use cases and for\nApp Engine, we recommend using Firestore in\nDatastore mode for databases that will be used primarily by\nApp Engine apps. Firestore in Native mode is most useful for\nmobile and real-time notification use cases. For more information about\nFirestore modes, see [Choosing between Native Mode and\nDatastore mode](/datastore/docs/firestore-or-datastore).\n\nUsing Datastore mode with App Engine\n------------------------------------\n\nTo use Datastore mode with App Engine:\n\n1. If you haven't already done so,\n [create a database](/datastore/docs/store-query-data#create_a_database)\n and choose Firestore in Datastore mode.\n\n You can use existing Datastore databases with App Engine\n apps. These existing databases [will be automatically upgraded to\n Firestore in Datastore\n mode](/datastore/docs/upgrade-to-firestore).\n\n\n 1. In your app, declare Datastore as a dependency\n\n by adding `google/cloud-datastore` to your app's `composer.json` file and running\n `composer install` from your app's directory. Learn more about\n [composer](https://getcomposer.org).\n\n \u003cbr /\u003e\n\n 2. Use the Google Cloud Client Library to\n [read and write entities](/datastore/docs/concepts/entities)\n and to [query data](/datastore/docs/concepts/queries).\n\n Configuring indexes\n -------------------\n\n Datastore mode uses\n [indexes](/datastore/docs/concepts/indexes)\n for every query your application makes. The indexes are updated whenever an\n entity changes, so the results can be returned quickly when the app makes a\n query.\n\n Datastore mode automatically creates single-property indexes for use with\n simple types of queries. For complex queries that include multiple properties,\n you'll need to configure composite indexes in your app's `index.yaml` file.\n\n The App Engine development server will update your `index.yaml` file\n with the composite indexes needed to run your tests. Similarly, the\n [Datastore mode emulator can generate indexes](/datastore/docs/tools)\n when you run tests.\n\n You can also add the indexes to your app's\n `index.yaml` file [manually](/appengine/docs/legacy/standard/php/configuring-datastore-indexes-with-index-yaml) if you do not run local\n tests or your tests do not include complex queries.\n\n Setting database permissions\n ----------------------------\n\n By default, your app has all the permissions required to read and write to\n Datastore mode and Firestore databases in your\n Google Cloud project.\n\n To manage these permissions, each App Engine app uses a [default service\n account](/appengine/docs/legacy/standard/php/service-account)\n that gives full read and write access to Datastore mode\n and Firestore databases in the same project as the app. You can\n [change the permissions of the default service\n account](/appengine/docs/legacy/standard/php/access-control#modify-service-account),\n but your app may lose access unless you assign an IAM role with the\n [required permissions](/datastore/docs/access/iam#required_permissions).\n\n For information about allowing other users, apps, or projects to access a database, see\n [Accessing your database](/datastore/docs/activate).\n\n Using the Datastore mode emulator for local testing\n ---------------------------------------------------\n\n The Google Cloud CLI includes a local [emulator of the production Datastore mode\n mode environment](/datastore/docs/tools/datastore-emulator). You can use the emulator to develop and test your application locally. In addition, the emulator can help you generate indexes for your production Datastore mode mode instance and delete unneeded indexes.\n\n \u003cbr /\u003e\n\n If you use the App Engine [local development\n server](/appengine/docs/legacy/standard/python/tools/using-local-server) to test your\n app, you can ensure that the server will use the Datastore mode\n emulator by setting the `--support_datastore_emulator=true` flag when starting\n the server.\n\n If you are using the Datastore mode emulator, dev_appserver will display: \n\n ... Using Cloud Datastore Emulator.\n\n Pricing, quotas, and limits\n ---------------------------\n\n Datastore mode offers a free quota with daily limits. Paid\n accounts offer unlimited storage, read, and write operations. More information\n is available on the [Datastore Quotas](/appengine/docs/legacy/standard/php/quotas#Datastore) page."]]