Supercharge your PHP serverless applications
IBM Cloud Functions added support for PHP 7.1 last year, and with the release of 7.2, we are updating! With PHP 7.2 you can ensure better app performance. In addition to lowering your total cost of ownership (TCO), you can improve your user experience by taking advantage of faster response times for blocking requests.
When is 7.2 available?
Now! To update your version, all you need to do is re-deploy your actions by using
php:7.2 in your code. This can be done through the CLI or through the GUI. If you’re on version 7.1, you’ll want to make the update as soon as possible as PHP 7.1 has already been deprecated. When 7.1 is removed from the service, which will happen very soon, any support requests will be redirected to the PHP 7.2.
There are significant changes in speed between 7.1 and 7.2. You should be able to see the improvements in both cold and warm invocations for you PHP 7.2 actions. Check out the following chart to see a comparison of a hello world action that uses 256MB in both PHP 7.1 and 7.2.
New to IBM Cloud Functions?
Excellent! Welcome aboard. The best way to try out the service or get started quickly is to use a hello world action. To read more about using PHP and Functions, check out the docs.
Create a file called hello.php that contains the following code:
function main(array $args) : array
$name = $args["message"] ?? "World";
$greeting = "<h1>Hello World</h1>";
return ["body" => $greeting];
Deploy your action as a web action:
ibmcloud fn action update helloPHP hello.php --kind php:7.2 --web true
Get the URL for the web action and open it in your browser by running the following command.:
ibmcloud fn action get helloPHP --url
Feedback and questions
We’d love to hear from you with feedback and questions! You can get help for technical questions at Stack Overflow by using the
ibm-functions tag. For non-technical questions, you can find us at IBM developerWorks with the
functions tag. For defect or support needs, use the support section that is found in the IBM Cloud menu.