Solved

PHP5 and OpenSSL

Posted on 2008-10-23
5
1,543 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
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…

710 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