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.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Il traffico proveniente dalle socket viene fatturato come
larghezza di banda in uscita.
App Engine supporta le socket in uscita utilizzando i metodi della libreria PHP standard, come fsockopen.
Per le opzioni supportate, le chiamate a
socket_get_option
restituiranno un valore simulato e le chiamate a
socket_set_option
verranno ignorate silenziosamente. Continueranno a essere generati errori per le opzioni non supportate.
Le opzioni supportate sono:
SO_KEEPALIVE
SO_DEBUG
TCP_NODELAY
SO_LINGER
SO_OOBINLINE
SO_SNDBUF
SO_RCVBUF
SO_REUSEADDR
Limitazioni e restrizioni
Il supporto delle socket in App Engine presenta le seguenti limitazioni:
Non puoi creare una socket di ascolto; puoi creare solo socket in uscita.
FTP non è supportato.
Puoi utilizzare solo TCP o UDP; i protocolli arbitrari non sono consentiti.
Non puoi eseguire il binding ad indirizzi IP o porte specifici.
La porta 25 (SMTP) è bloccata, ma puoi comunque utilizzare SMTP autenticato sulla porta di invio 587.
Gli intervalli IP privati, di trasmissione, multicast e di Google sono bloccati, ad eccezione di quelli elencati di seguito:
Google Public DNS: 8.8.8.8, 8.8.4.4, 2001:4860:4860::8888,
2001:4860:4860::8844 porta 53
SMTPS di Gmail: smtp.gmail.com porta 465 e 587
Gmail POP3S: pop.gmail.com porta 995
IMAPS di Gmail: imap.gmail.com porta 993
I descrittori di socket sono associati all'app App Engine che li ha creati e non sono trasferibili (non possono essere utilizzati da altre app).
Le socket possono essere recuperate dopo 10 minuti di inattività; qualsiasi operazione sulla socket mantiene la socket attiva per altri 10 minuti.
Utilizzo dei socket con il server di sviluppo
Puoi eseguire e testare il codice utilizzando le socket sul server di sviluppo, senza utilizzare parametri della riga di comando speciali.
[[["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\u003eThis socket API is not recommended anymore, as apps using it are limited to the PHP 5 runtime and need to migrate to a different solution before upgrading to PHP 7/8.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine supports outbound sockets through standard PHP library methods like \u003ccode\u003efsockopen\u003c/code\u003e, with limited options for \u003ccode\u003esocket_get_option\u003c/code\u003e and \u003ccode\u003esocket_set_option\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eOnly outbound sockets are allowed; creating listen sockets is not possible, and certain protocols like FTP and arbitrary protocols are unsupported.\u003c/p\u003e\n"],["\u003cp\u003eSpecific restrictions apply, such as the inability to bind to specific IPs or ports, the blocking of port 25, and the blocking of private, broadcast, and multicast IP ranges, except for specific Google services like Google Public DNS and Gmail.\u003c/p\u003e\n"],["\u003cp\u003eSockets are non-transferable and may be automatically reclaimed after 10 minutes of inactivity, with any socket operation extending their life by another 10 minutes.\u003c/p\u003e\n"]]],[],null,["# Sockets API for legacy bundled services\n\n| **Caution:** **This solution is no longer recommended:** Apps that use this API can only run in the PHP 5 runtime and will need to upgrade to a [recommended solution](/appengine/migration-center/standard/services/migrating-services) before migrating to the PHP 7/8 runtime.\n\nTraffic from sockets is billed as [outgoing bandwidth](/appengine/docs/pricing#Billable_Resource_Unit_Costs). App Engine supports outbound sockets using methods from the standard PHP library such as [`fsockopen`](http://www.php.net/function.fsockopen). For supported options, calls to [`socket_get_option`](http://php.net/manual/en/function.socket-get-option.php) will return a mock value and calls to [`socket_set_option`](http://www.php.net/manual/en/function.socket-set-option.php) will be silently ignored. Errors will continue to be raised for unsupported options. The supported options are:\n\n\u003cbr /\u003e\n\n- `SO_KEEPALIVE`\n- `SO_DEBUG`\n- `TCP_NODELAY`\n- `SO_LINGER`\n- `SO_OOBINLINE`\n- `SO_SNDBUF`\n- `SO_RCVBUF`\n- `SO_REUSEADDR`\n\nLimitations and restrictions\n----------------------------\n\nSocket support in App Engine has the following limitations:\n\n- You cannot create a listen socket; you can only create outbound sockets.\n- FTP is not supported.\n- You can only use TCP or UDP; arbitrary protocols are not allowed.\n- You cannot bind to specific IP addresses or ports.\n- Port 25 (SMTP) is blocked; you can still use authenticated SMTP on the submission port 587.\n- Private, broadcast, multicast, and Google IP ranges are blocked, except\n those listed below:\n\n - Google Public DNS: `8.8.8.8`, `8.8.4.4`, `2001:4860:4860::8888`, `2001:4860:4860::8844` port 53\n - Gmail SMTPS: `smtp.gmail.com` port 465 and 587\n - Gmail POP3S: `pop.gmail.com` port 995\n - Gmail IMAPS: `imap.gmail.com` port 993\n\n | **Note:** Google Compute Engine IP addresses are not considered to be in Google IP ranges. You can use sockets to connect App Engine apps to Compute Engine instances.\n- Socket descriptors are associated with the App Engine app that\n created them and are non-transferable (cannot be used by other apps).\n\n- Sockets may be reclaimed after 10 minutes of inactivity; any socket operation\n keeps the socket alive for a further 10 minutes.\n\n\n Using sockets with the development server\n -----------------------------------------\n\n You can run and test code using sockets on the development server, without using\n any special command line parameters."]]