November 16, 2018 By Carlos Santana 2 min read

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.

How fast?

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.

  1. Download the IBM CLI and the Functions plugin.

  2. 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];
    }
  3. Deploy your action as a web action:

    ibmcloud fn action update helloPHP hello.php --kind php:7.2 --web true
  4. 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.

More from Announcements

IBM and SAP unlock business and industry value with new generative AI solutions 

3 min read - IBM Consulting is delivering on our commitment to co-innovate with SAP and collaborate with our clients. As part of our Value Generation Partnership initiative announced earlier this month with SAP, we are releasing the first 10 of 100 planned AI solutions to help clients transform their industries, optimize their business processes and successfully deliver their SAP programs.  Delivering AI business and industry innovation at scale  With the recently announced Value Generation Partnership initiative, IBM and SAP are co-innovating intelligent industry…

IBM SevOne 7.0: Reaching application-centric multicloud network observability  

2 min read - As enterprises increasingly rely on network connectivity to support cloud-based applications and remote workers, network managers require new methods to monitor and safeguard connectivity across diverse environments, including corporate networks, software-defined WANs and multiple public cloud providers.   According to the recent EMA Network Megatrends Report, responding network professionals believe that 53% of network outages and performance issues could be prevented with improved network management tools, yet only 9% find it very easy to hire skilled networking personnel. This is why…

IBM Hybrid Cloud Mesh and Red Hat Service Interconnect: A new era of app-centric connectivity 

2 min read - To meet customer demands, applications are expected to be performing at their best at all times. Simultaneously, applications need to be flexible and cost effective, and therefore supported by an underlying infrastructure that is equally reliant, performant and secure as the applications themselves.   Easier said than done. According to EMA's 2024 Network Management Megatrends report only 42% of responding IT professionals would rate their network operations as successful.   In this era of hyper-distributed infrastructure where our users, apps, and data…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters