Solved

PHP5 and OpenSSL

Posted on 2008-10-23
5
1,537 Views
Last Modified: 2013-12-13
A script that use to work fine doesn't anymore. Now I get the error:
Notice: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

When I do print_r(get_loaded_extensions()); openssl does not appear, but I'm using PHP5, which has openssl included.

I'm using WHM/Cpanel but I can also edit php.ini manually. Any ideas? In php.ini php_openssl.dll is not listed next to "extensions"
0
Comment
Question by:phper
  • 2
5 Comments
 
LVL 6

Expert Comment

by:thebradnetwork
ID: 22788783
Place the following line in your php.ini file.
extension=php_openssl.dll

Open in new window

0
 

Author Comment

by:phper
ID: 22788908
I added that, restarted httpd & sshd, which restarted. But got the same error on the script. Tried to graceful & forceful restarts but got this error both times:

cpsrvd failed @ Thu Oct 23 13:56:00 2008. A restart was attempted automagically.
Failure Reason: Unable to connect to port 2086

Then I restarted httpd & sshd again but the error on the script remains.

When I do print_r(get_loaded_extensions()); openssl still does not appear,
0
 

Author Comment

by:phper
ID: 22789681
From the error_logs

[23-Oct-2008 13:51:06] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
0
 
LVL 3

Accepted Solution

by:
raminhos earned 500 total points
ID: 22791726
Hello, i made a simple how-to for myself, to use whenever i need.

I couldn't attach my zip file, so i will place here my little how to and the files you require

I need to have php 5 with ssl installed..

If you want i can email you with all the files i use in my mini how to..


BIN:
- libeay32.dll
- openssl
- openssl.exe
- ssleay32.dll

CONF
- ssl.conf

MODULES
- mod_ssl.so



Install SSL in Apache

Copy the following files to apache/bin directory
libeay32.dll
openssl.cnf
openssl.exe
ssleay32.dll


Copy the ssl.conf file to apache/conf directory
Create a folder named ssl inside apache/conf


Copy the file mod_ssl.so to folder apache/modules

Now, lets generate certeficate and keys

Inside the folder bin of apache in commando prompt:

Check the key: ServerName in httpd.conf so we can fill the CN in the certeficate creation

openssl req -config openssl.cnf -new -out nome_servidor.csr
openssl rsa -in privkey.pem -out nome_servidor.key
openssl x509 -in nome_servidor.csr -out nome_servidor.cert -req -signkey nome_servidor.key -days 1095


Now that we have the certs and keys, lets move the .cert and .key files to apache/conf/ssl


Edit httpd.conf file and change:

- uncomment: LoadModule rewrite_module modules/mod_rewrite.so


Add:

Include conf/ssl.conf
LoadModule ssl_module modules/mod_ssl.so


Edit ssl.conf and change the following directives with the both names generated (.key and .cert)

SSLCertificateFile
SSLCertificateKeyFile



If you want to force http to redirect to https:

Place the following inside httpd.conf:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question