Fueling Your Coding Mojo

Buckle up, fellow PHP enthusiast! We're loading up the rocket fuel for your coding adventures...

Popular Searches:

I'm encountering "configure: error: Cannot find OpenSSL" during the PHP installation process. How can I resolve this issue?

I have been trying to install PHP on my system, but I encountered an error during the installation process. The error message I received says "configure: error: Cannot find OpenSSL".

I have already installed OpenSSL on my system, so I am not sure why the installation process is unable to locate it. I have checked the OpenSSL installation directory and everything seems to be in order.

I am using Ubuntu 20.04 and have tried installing PHP from source code using the following command:
./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl=/usr/bin/openssl

I have also tried several variations of the above command, but the error still persists.

I would appreciate any guidance or suggestions on how to resolve this issue and successfully install PHP on my system. Thank you in advance for your help!

All Replies


User 2:
Ah, I remember encountering the "configure: error: Cannot find OpenSSL" error while setting up PHP on my macOS system. It was quite a puzzle to solve, but I managed to find a solution that might help you.

First things first, ensure that you have OpenSSL installed on your system. You can verify this by running `openssl version` in your terminal. If OpenSSL is not installed, you can install it using a package manager like Homebrew by running `brew install openssl`.

If OpenSSL is already installed, the issue might lie in the PHP configuration. Try specifying the OpenSSL path explicitly during the configuration process. Instead of just `--with-openssl=/usr/bin/openssl`, try providing the complete path to the OpenSSL library and header files using `--with-openssl=/usr/local/opt/openssl`.

Additionally, make sure you have the OpenSSL development package installed on your system. This package provides the necessary header files required during the PHP installation. On some distributions, it may be named `openssl-dev` or `libssl-dev`.

Once you have made these changes, retry the PHP configuration and compilation process. With luck, the "Cannot find OpenSSL" error won't trouble you anymore.

If the issue persists, it might be worth checking if there are any conflicting installations or incorrect environment variables interfering with the OpenSSL detection.

Good luck, and let me know if you have any further questions or need clarification on any of the steps!


User 1:
I've encountered a similar issue while installing PHP on my CentOS system. The error message "configure: error: Cannot find OpenSSL" was quite frustrating, but I eventually found a solution.

First, I verified that OpenSSL was installed by running the command `openssl version` in the terminal. If OpenSSL is not installed, you can install it using the package manager specific to your distribution. For example, on CentOS, you can run `sudo yum install openssl`.

If OpenSSL is already installed, the issue might be with the OpenSSL development package. In my case, I resolved the problem by installing the OpenSSL development package. For CentOS, the command is `sudo yum install openssl-devel`.

After installing the OpenSSL development package, I reconfigured and recompiled PHP using the `./configure` command again. This time, it successfully detected OpenSSL and completed the installation without any further issues.

I hope this helps resolve the problem for others experiencing a similar issue. Let me know if you have any further questions.

New to LearnPHP.org Community?

Join the community