Upgrading php in tomcat stack

Keywords: Tomcat - Google Cloud Platform - How to - Upgrade
My tomcat stack runs an obsolete version of php and I need to update it to 5.6 or 7.
Is there a way I can do this without installing migrating to the latest stack.
From what I was reading, it appears with the bitnami tomcat stack the various components are decoupled and can be upgraded individually without updating the whole stack. Is that correct ?

Hello @vipul

I am afraid that there is not an easy way to do it without migrating to the latest stack. Indeed, we highly recommend to use this method since it will update many outdated components on the stack (such as Apache, PHP, OpenSSL, Tomcat, etc.)

There’s a way to upgrade PHP on the stack without migrating to a new one but it consist on disabling PHP on the stack, install PHP using the system package (apt-get or yum) and adapt the environment so your stack uses the system package of PHP. Please note that will break the out-of-the-box advantage of Bitnami stacks and we do not recommend it.

Best Regards,

Juan Ariza

Was my answer helpful? Click on :heart:

Thanks for the revert @jariza
If I were to go ahead with the migration to a new server, I only have an option of moving to php 5.6 as that is the latest php version available on the stable tomcat stack. Is there a way I can go with php 7 using a stable bitnami tomcat stack ?

What would be the simplest way to go ahead with the migration without downtime as I already have a blog and a tomcat application set up on this stack in a live environment?

Is there a reference to tasks that need to be executed to use the php outside the stack. I prefer not to use this approach, but the wordpress theme I have purchased required php 7 and I had rather be switching to the latest upgrade since the process requires a server migration


There is a little guide to some steps that should work for you:

1 - Launch a LAMP stack with PHP 7.
As bitnami user:
2- sudo su bitnami
3 - Stop all services: sudo /opt/bitnami/ctlscript.sh stop
4 - Compress php folder: sudo tar zcf /tmp/php7.tar.gz php.
5 - Move the php7.tar.gz file to your tomcat stack.
You can now delete the LAMP instance.
In your Tomcat stack:
6 - Make a backup of your installation IMPORTANT
7 - Stop all services: sudo /opt/bitnami/ctlscript.sh stop
8 - Uncompress the tar.gz file: sudo tar zxf /tmp/php7.tar.gz -C /opt/bitnami/php
9 - Restart services: sudo /opt/bitnami/ctlscript.start

If all went fine you will have your Tomcat stack using PHP 7.

Hope it helps.

Best regards,
Silvio Fernández

Thanks @silvio for the tip.
That sounds like a great way to work around the current issue I am facing.

I have followed the steps outlined by you.

After restarting the server, I see this message
/opt/bitnami/php/bin/php.bin: error while loading shared libraries: libicui18n.so.52

Did I miss out on something ?

This is the compete message received while starting the server:

/opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306
/opt/bitnami/apache-tomcat/scripts/ctl.sh : tomcat started
/opt/bitnami/php/sbin/.php-fpm.bin: error while loading shared libraries: libicui18n.so.52: cannot open shared object file: No such file or directory
/opt/bitnami/php/scripts/ctl.sh : php-fpm configuration is incorrect
Syntax OK


Which Tomcat stack version are you using? Our stack does not include php-fpm from some time go.
If it is a really old stack I think the best option is to migrate your data (files, configuration, etc) to a new one.

Best regards,
Silvio Fernández

I set up a lamp stack with LAMP 7.1.15-0.
Compressed it and moved it to the tomcat instance and uncompressed it into the php folder.

Maybe LAMP 7.1.15-0 wasn’t the right stack to install? Which version of Lamp would be ideal. I installed using google cloud hosting.


Currently, we only offer LAMP with PHP 7.1 in Google Cloud. If you are using an old version of Tomcat stack or one with lots of customizations, I recommend you to proceed as I advice in my last message.

Best regards,
Silvio Fernández

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.