You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow the [Cloud Run function quickstart](https://cloud.google.com/run/docs/quickstarts/functions/deploy-functions-gcloud#php) for PHP to learn how to deploy a function to Cloud Run.
121
118
122
-
To run your function on Cloud Functions, first you must have the [gcloud SDK][gcloud] installed and [authenticated][gcloud-auth].
119
+
## Run your function as a container in Cloud Run
123
120
124
-
Make sure your source file (which defines your function) is called
125
-
`index.php`. The Functions Framework lets you choose a function source file,
126
-
but Cloud Functions currently uses the default of `index.php`.
127
-
128
-
Decide _which_ function in the source file to invoke, that is, the name that you
129
-
used when writing the function. This is called the **target**.
130
-
131
-
Choose a Cloud Functions **name** for your function. The **name** identifies
132
-
this function deployment (e.g. in the cloud console) and is also part of the
133
-
function's default URL. (Note: the **name** and the **target** do not have to
134
-
be the same value.)
135
-
136
-
Then, from the directory containing your function source, issue the gcloud command to deploy:
137
-
138
-
```sh
139
-
gcloud functions deploy $YOUR_FUNCTION_NAME \
140
-
--runtime=php74 \
141
-
--entry-point=$YOUR_FUNCTION_TARGET \
142
-
--trigger-http
143
-
```
144
-
145
-
The `--entry-point` flag can be omitted if the **target** has the same value
146
-
as the **name**.
147
-
148
-
If your function handles events rather than HTTP requests, you'll need to
149
-
replace `--trigger-http` with a different trigger. For details, see the
> **NOTE**: Be sure to replace `$GCLOUD_PROJECT` with your Google Cloud project
174
-
ID, or set the environment variable using `export GCLOUD_PROJECT="some-project-id"`.
175
-
176
-
Next, push your image to [Google Container Registry](https://cloud.google.com/container-registry). This will allow you to deploy it directly from Cloud Run.
You can manually build your function as a container and deploy it into Cloud Run. Follow the [Cloud Run instructions for building a function](https://cloud.google.com/run/docs/building/functions) for complete instructions.
0 commit comments