How to Compile PHP With SSL
As a language designed explicitly for developing web applications, PHP comes with most of the tools web developers need out of the box. However, the majority of websites only need Secure Socket Layer (SSL) encryption for creating a secure connection with users. This is done by the web server (i.e,. Apache), not by PHP. So SSL support does not come with PHP by default. To get it, you must install OpenSSL.
Instructions
-
Install OpenSSL
-
1
Download the latest OpenSSL software from the OpenSSL website.
-
2
Install OpenSSL according to the instructions provided with it. Some aspects of installation may be different depending on your operating system or file system structure.
-
-
3
Make a note of the directory where OpenSSL is installed.
Install PHP and Test
-
4
Download the latest PHP software from the PHP website.
-
5
Configure the installation process to include SSL support. Refer to the installation documentation on the PHP website. You will see that part of installation is creating the configuration command. In this command, you will need to include a directive to install SSL. This directive looks like "--with-open-ssl=" followed by the directory where OpenSSL is installed on your computer. So if OpenSSL is in "/usr/local/ssl," then your directive will be "--with-open-ssl=/usr/local/ssl." Place this directive at the end of your configure command.
-
6
Run the configuration command according to the installation instructions on the PHP website and finish the installation.
-
7
Check that SSL support was installed by creating a script that runs the "phpinfo()" command. When you run the script and look at the page it creates, you will see a lot of boxes containing information about your PHP installation. If you see a box whose header reads, "OpenSSL," then your installation was successful.
-
1
Tips & Warnings
Make sure you compile with the latest version of OpenSSL. You will be using this module to secure sensitive data, and bugs in OpenSSL are corrected with each release. If you don't use the most recent one, your software could be vulnerable to attacks.
References
Resources
- Photo Credit computer security concept - usb cable and padlock isolated image by dinostock from Fotolia.com