Will GAE PHP flexible images ever include the imap module?

78 views
Skip to first unread message

Karl Tinawi

unread,
Oct 24, 2017, 9:01:33 AM10/24/17
to Google App Engine
Hi,

Firstly can I thank you for offering this community support - it's invaluable.

My question is whether or not GAE is planning to include additional PHP modules in the PHP docker image? Although the process of activating modules is rather good, either in composer or with a php.ini file in the project root, but I notice that some modules, like imap are not available. Is there a plan in future images to include these, and if not, are there any alternatives to connecting to an IMAP server to read emails?

The reason I ask is because as a B2B company integrating with our customers' mailboxes is a key customer requirement.

Alternatively, if there are other optimal solutions that do not use the imap module, I'm all ears. Although this would require a bit of rework.

One solution I'm starting to entertain is to create our own 'custom' deployment complete with our own Dockerfile. This does seem a bit OTT though...

Many thanks in advance for your help.

Karl

Yannick (Cloud Platform Support)

unread,
Oct 24, 2017, 4:50:27 PM10/24/17
to google-a...@googlegroups.com
Hello Karl,

I believe that for the time being using a custom runtime would be the best way for you to use the imap extension.

There is an existing feature request for the imap extension to be added to App Engine's PHP, but it has not received a lot of attention from the community, meaning it is less likely to be picked up by engineering. You can show your interest for a feature by clicking the "Me too" button at the top of the interface. You can see a list of the most voted for AppEngine issues here.

Karl Tinawi

unread,
Oct 24, 2017, 8:20:47 PM10/24/17
to Google App Engine
Hi Yannick,

Many thanks for your reply and for pointing me in the direction of that feature request. I wasn't able to find the "Me too" button but did add a comment instead... I really do hope that imap will be available soon.

In the meantime I've had my first stab at creating a docker file (ever). I'll post it here in case it's of any use to anybody, it's by no means perfect and yet to be tested thoroughly:

# Dockerfile extending the generic PHP image with application files for a single application.
FROM gcr.io/google-appengine/php:latest

# Add PHP 7.1 package to apt repository
RUN DEBIAN_FRONTEND=noninteractive && \
apt
-get install -y --no-install-recommends apt-transport-https lsb-release ca-certificates wget lsb-release vim; \
wget
-O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; \
echo
"deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list;

# Install PHP 7.1
RUN DEBIAN_FRONTEND=noninteractive && \
apt
-get update && apt-get install -y --no-install-recommends php7.1 php7.1-common php7.1-cli php7.1-curl php7.1-gd php7.1-imap php7.1-intl php7.1-json php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-soap php7.1-xml php7.1-xmlrpc php7.1-xsl php7.1-zip php-apcu php-ds php-fpm php-http php-mailparse php-memcached php-oauth php-sodium php-uuid php-yaml;

# Overwrite Google's PHP version with ours.
# Keep various configurations to not break things!
# This is based on the Docker image for running PHP applications on the App Engine Flexible Runtime: https://github.com/GoogleCloudPlatform/php-docker
RUN DEBIAN_FRONTEND=noninteractive && \
mv
"${PHP71_DIR}" "${PHP71_DIR}"_GAE && rm -f "${PHP_DIR}"; \
ln
-s "/etc/php/7.1/" ${PHP71_DIR} && ln -s "/etc/php/7.1/" ${PHP_DIR}; \
mkdir
-p "${PHP71_DIR}"/bin && ln -s "$(which php)" "${PHP71_DIR}"/bin/php; \
mkdir
-p "${PHP71_DIR}"/etc && cp "${PHP_CONFIG_TEMPLATE}"/php-fpm.conf "${PHP71_DIR}"/etc/php-fpm.conf && touch "${PHP71_DIR}"/etc/php-fpm-user.conf && cp "${PHP71_DIR}"/etc/*.conf "${PHP71_DIR}"/cli/; \
mkdir
-p "${PHP71_DIR}"/lib && cp "${PHP_CONFIG_TEMPLATE}"/php-cli.ini "${PHP71_DIR}"/lib/ && cp "${PHP_CONFIG_TEMPLATE}"/php-cli.ini "${PHP71_DIR}"/cli/; \
mkdir
-p "${PHP71_DIR}"/sbin && ln -s /usr/sbin/php-fpm7.1 /opt/php/sbin/php-fpm

# The Docker image will configure the document root according to this
# environment variable.
ENV DOCUMENT_ROOT /app/public

WORKDIR $APP_DIR

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

Hopefully this will keep us on track for now. Please do let me know if the above seems like a terrible solution.

Thanks again kindly for your help.

Karl
Reply all
Reply to author
Forward
0 new messages