White screen error with eZ Platform Cloud & other Symfony + Platform.sh based PaaS
eZ Platform Cloud is a PaaS based on Platform.sh technology, there are other similar services such as SensioCloud and Magento cloud as well - and there's the unbranded Platform.sh as well. One thing you can also do is change PHP versions by changing the app config in .platform.app.yaml:
# The type of the application to build. type: php:7.2
I was doing some work and decided to hop back to PHP 7.1 to see wheter an issue was related to the version. I changed this setting and deployed. Then I was hit with an issue where a blank screen was displayed.
Nothing in the logs (in var/log/ or /var/log/), just HTTP 200 OK. Business as usual? 🤔
I tried a number of things to figure out the cause, but it was very simple in the end. The PHP version change corrupted the cache in such a way that there were no errors, just the blank page. The application I was running was eZ Platform, a Full Stack Symfony CMS - so I imagine this might happen to any Symfony based application.
The deployment hook and others used the standard Symfony command for cache clearing:
./bin/console cache:clear --env=prod
This did not help, instead I needed to do a raw deletion of cache files:
rm -rf ./var/cache/*
Once this was done, then the application worked fine again. The issue only occured to me when I was downgrading PHP from 7.2 to 7.1. But it took me a while to figure out. Note: If you're working with eZ Platform version 1.13 or eZ Publish 5.4, then the directories for cache will be app/cache or ezpublish/cache.
Hopefully this article will help you if you face HTTP communications which look something along the lines of:
* Trying xx.xx.xx.xx... * TCP_NODELAY set * Connected to test-t6dnbai-YOURINSTANCEID.eu.platform.sh (xx.xx.xx.xx) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /etc/ssl/cert.pem CApath: none * TLSv1.2 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS handshake, Server key exchange (12): * TLSv1.2 (IN), TLS handshake, Server finished (14): * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): * TLSv1.2 (OUT), TLS change cipher, Client hello (1): * TLSv1.2 (OUT), TLS handshake, Finished (20): * TLSv1.2 (IN), TLS change cipher, Client hello (1): * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256 * ALPN, server accepted to use h2 * Server certificate: * subject: CN=test-t6dnbai-YOURINSTANCEID.eu.platform.sh * start date: Feb 20 11:57:31 2018 GMT * expire date: May 21 11:57:31 2018 GMT * subjectAltName: host "test-t6dnbai-YOURINSTANCEID.eu.platform.sh" matched cert's "test-t6dnbai-YOURINSTANCEID.eu.platform.sh" * issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3 * SSL certificate verify ok. * Using HTTP2, server supports multi-use * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * Using Stream ID: 1 (easy handle 0x7fdd7180a400) > GET / HTTP/2 > Host: test-t6dnbai-YOURINSTANCEID.eu.platform.sh > User-Agent: curl/7.54.0 > Accept: */* > * Connection state changed (MAX_CONCURRENT_STREAMS updated)! < HTTP/2 200 < content-type: text/html; charset=UTF-8 < date: Tue, 20 Feb 2018 14:38:32 GMT < strict-transport-security: max-age=0 < x-correlation-id: elite1337elite1337 < x-debug-info: elite1337elite1337== < x-platform-cluster: YOURINSTANCEID-test-t6dnbai < x-platform-processor: YOURINSTANCEID-test-t6dnbai--app < x-platform-router: YOURINSTANCEID-test-t6dnbai--router < x-robots-tag: noindex, nofollow < content-length: 0 < * Connection #0 to host test-t6dnbai-YOURINSTANCEID.eu.platform.sh left intact