-
Notifications
You must be signed in to change notification settings - Fork 370
PHP Installation fails on Ubuntu 22.04 WSL2 #1280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@7ahery on OSX with homebrew (and I think you could have the same with Ubuntu), you can also build with |
@theofidry The issue is that when I build with
But |
@7ahery I think that's because you specific the |
@theofidry I think the same can not be said for Ubuntu as OpenSSL Even when I build and install OpenSSL 1.1.1 manually in a single folder, with |
I just found out that although you are able to install PHP<8.0 with the solution I provided above, Only PHP 7.4 will correctly recognize OpenSSL and work, anything lower will throw an error indicating OpenSSL Extension is not installed. This error will be obvious when for example you run a So this is not completely and reliably solved on Ubuntu 22.04. We need a way to retain Ubuntu 22.04 default OpenSSL but be able to install PHP versions lower than 8.0. |
I can confirm that phpbrew can install any PHP version>=5.6 without any issue on Ubuntu 20.04. So this is definitely an issue related to Ubuntu 22.04. |
The solutions are available for the following references: |
Error 🔴
Running phpbrew on Ubuntu 22.04 WSL2, when I try to install any PHP version lower than
8.0
I get various errors related to OpenSSL. My take is that this is most likely related to OpenSSL 3 being the default in Ubuntu 22.04 but lower PHP versions need OpenSSL 1.1.1 to build.Here are the errors:
Solution (Partial - Please read this comment)
Use At Your Own Risk
This was the only way I was able to fix these errors.
sudo apt remove openssl
cd
to OpenSSL source folder.config
file executable:chmod +x config
./config
make
make test
sudo make install
phpbrew install 7.0 +default +openssl=shared -- --with-openssl-dir=/usr/include/openssl
which essentially tells the installed PHP version to use the OpenSSL path you provide.! Important Note ! You can not have two versions of OpenSSL activated simultaneously. With this approach you are eliminating OpenSSL 3 lib from Ubuntu 22.04 so please make sure you know what you are doing.
To uninstall OpenSSL 1.1.1,
cd
to OpenSSL source folder and runsudo make uninstall
.To install back OpenSSL 3, first remove OpenSSL 1.1.1 and then run:
sudo apt install openssl
.Note: When installing PHP 5.6 you may face a curl error
easy.h should be in <curl-dir>/include/curl/
. In that case please check out this answer.The text was updated successfully, but these errors were encountered: