1

I was wondering now, I have developed a Helpdesk System, than uses the PHP imap library to connect to configured mailbox's and "pull" the mails through and create tickets based on the content.

But alas I've run into an issue, some of the servers that our application is deployed on the PHP was not compiled with the --with-imap-ssl flags.

My first thought for the solution was too:

  1. login to each of the servers via SSH
  2. execute php-config copy the build flags
  3. recompile php with the --with-imap-ssl flag and all other flags from the previous step

But then some clients might not let us recompile PHP as they are utilizing this for other applications. and also this is a bit of a DevOps Nightmare as we will have to do this at Night to make sure that no one is using their servers and make them all aware that we will be recompiling php so we will disable apache for $N period of time whilst this process is happening.

Then i thought another solution would be:

  1. Get all the different versions of PHP running on the servers
  2. Ensure that all the openSSL paths are the same /usr
  3. Spin up a vm foreach flavor of Linux (CentOS / Ubuntu)
  4. cd /tmp && wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz OR get whatever other versions of IMAP people are running.
  5. tar xzf imap-2007f.tar.gz
  6. sudo mv imap-2007f /usr/local
  7. Compile imap
  8. Download all required versions of php
  9. compile with the --with-imap-ssl flag
  10. We will then have the required "imap.so" file that we will need for that Specific PHP Version
  11. scp that imap.so file onto the clients server and restart apache then php will hopefully have imap-ssl support without breaking anything else on the server.

Now the questions are:

  1. Is there a better way to do this ?
  2. Will these methods work at all ?
  3. What steps to follow to automate this process ?

1 Answers1

1

Have you investigated using a container service, such as Docker or LXC? That would allow you to use the version of PHP and OpenSSL (and many other programs as well) that you desire. It also wouldn't interfere with the system's PHP and SSL installations, it's entirely self-contained.

Docker has prebuilt PHP environments it seems: https://hub.docker.com/_/php/

LXC how-to: http://www.phpclasses.org/blog/post/290-Simplify-Your-PHP-Applications-Testing-Using-LXC-in-Your-Development-Environment.html

If you're brand new to containers, I'd say that Docker is a good place to start, as there is a boat load of community support for it.

zymhan
  • 1,371
  • 1
  • 17
  • 30
  • Yes i was thinking about going the container route, read this question http://stackoverflow.com/questions/16647069/should-i-use-vagrant-or-docker-for-creating-an-isolated-environment and showed me a couple things. Was kind of searching for a temp solution just to get the correct imap.so file foreach version. but that being said it is always better to do things correctly once, but unfortunately time does not allow me to build a full docker container, even if that is the way that i agree it should be done in order to build the robust system we are after. – GardenRouteGold Mar 23 '16 at 06:32