I’ve installed the LAMP distribution on Ubuntu 16.04, and now I want to use threads in PHP7, but it wasn’t initially installed with ZTS enabled so now I need to reinstall it. Just wondering if there’s a guide to making this happen.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Man this seems like a huge amount of work for something so simple. Would you be able to recommend any other language that I could use for scripting with similar functionality to PHP but with threads already included?
@mstedman
If you want to run a test build using your configuration, you can install the required packages using:
I just ran a test using the above and built PHP 7.2.x successfully using the same configure options as you noted in your reply.
Keep in mind, unlike repository packages, some things don’t work as you might expect. You’ll need to set these things up on your own.
For example:
…won’t work as it would with a repository package. You’ll need to export the path or use the full path when calling PHP from the CLI.
i.e.
/etc/php7/bin/php -v
Also, there’s no service/systemd script for PHP-FPM, so you’d need to create that as well, otherwise you won’t be able to use:
@ryankr1
This can be done and I’m running a test on my mini-guide before posting them so I can troubleshoot before handing them over.
Upfront, this will require rebuilding PHP from source and there are a few warnings that come with it.
WARNINGS
Building from source is resource intensive and may fail on 512MB Droplets. It also takes a long time (20-30 minutes up to 1+ hours depending on resources), so be patient and don’t close out your connection.
I highly recommend building your package on a fresh droplet and transferring the package over to your existing. Why? The first command,
build-dep
is going to install numerous packages that most standard web servers do not need, thus creating more for you to update and manage.Create a snapshot of your existing Droplet before you install the created package. You will need to uninstall the current before you will be able to install the new. Additionally, creating a backup before you attempt to install the new package means you have a security blanket that’ll allow you to restore to previous state, prior to the package being installed.
Lastly, please note that by building your own packages, you are now responsible for updating them. This means that where you previously could simply run
apt-get -y upgrade
and the latest patches and fixes would be installed if available from the maintainer, you will have to go through the process I detail each time you need to rebuild to include what was updated, etc (i.e. security patches, bug fixes, etc).I’ll follow up shortly.