Solved

PHP5 and OpenSSL

Posted on 2008-10-23
5
1,527 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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now