473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Php (4.4) configured to open secure URLs (https)?

I use apache, Php and MySql on my Windows XP machine at home. I have
been doing so successfully now for a long time. However, I am now
trying to use fopen to open secure URLs (https) and having no luck. I
have installed openssl and enabled the extension (phpinfo says so,
too). But still it does not work.

I now realize that I need to have https and ftps as registered streams,
i.e.,
Registered PHP Streams php, http, ftp, https, ftps, compress.zlib
(from phpinfo at my hosting provider)

When I run phpinfo on my version of Php (which I just downloaded from
php.net) it says,
Registered PHP Streams php, http, ftp, compress.zlib

I've been reading forum posts saying to compile Php with
"--with-openssl in your ./configure
command."

Well, I do not compile Php from source (don't even have a C compiler).
I always download binaries (like php-4.4.0-Win32.zip that I downloaded
today from php.net).

How do I get a binary that was compiled with openssl in the configure
command? Or if I am misunderstanding something here, what is is that I
need to do?

Thanks in Advance,

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
Oct 11 '05 #1
4 2571
Chuck,
I've been reading forum posts saying to compile Php with
"--with-openssl in your ./configure
command."

Well, I do not compile Php from source (don't even have a C compiler).
I always download binaries (like php-4.4.0-Win32.zip that I downloaded
today from php.net).

How do I get a binary that was compiled with openssl in the configure
command? Or if I am misunderstanding something here, what is is that I
need to do?


Within the extensions folder you should see a php_openssl.dll
Also you should go to the openssl folder and read the README-SSL.txt
file. That file tells you how to implement it correctly within a
windows environment (which sometimes includes setting environment variables)

--
Mike Willbanks
Zend Certified Engineer
http://www.digitalstruct.com
Oct 12 '05 #2
Mike Willbanks wrote:
Chuck,

I've been reading forum posts saying to compile Php with
"--with-openssl in your ./configure
command."

Well, I do not compile Php from source (don't even have a C compiler).
I always download binaries (like php-4.4.0-Win32.zip that I downloaded
today from php.net).

How do I get a binary that was compiled with openssl in the configure
command? Or if I am misunderstanding something here, what is is that I
need to do?
Within the extensions folder you should see a php_openssl.dll

Yep. And I uncommented that line in php.ini. (extension=php_openssl.dll)
Also you should go to the openssl folder and read the README-SSL.txt
file.
Thanks for the help. I don't see any such file, however ......

...... I installed a compiled binary .... Win32OpenSSL-v0.9.8.exe ....
.... that I got from the Shining Light Productions site (a link from
openssl.org).
http://www.slproweb.com/products/Win32OpenSSL.html

In the help file (.chm for Windows) it says that I can uninstall it if I
do not plan on developing any apps that incorporate the SSL library and
it will leave the needed dlls in the Windows/system folder.

I understand that from what I've done, SSL should be properly installed
(I can use openssl from the command line) , however, Php still does not
show https and ftps as registered streams and I can not use fopen on
secure URLs.
That file tells you how to implement it correctly within a
windows environment (which sometimes includes setting environment variables)

I have found nothing about setting environment variables. ?? Do I need
to do something more in php (php.ini) or in Apache httpd.conf?

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
Oct 12 '05 #3
Chuck,
I have found nothing about setting environment variables. ?? Do I need
to do something more in php (php.ini) or in Apache httpd.conf?

This is what is contained in the readme-ssl.txt file (php4):

To use the CSR and key generation functions from PHP, you will need to
install
an openssl.cnf file. We have included a sample file that can be used
for this
purpose in this folder alongside this readme file.

The default path for the openssl.cnf file is determined as follows:

OPENSSL_CONF environmental variable, if set, is assumed to hold the
path to the file.

If it is not set, SSLEAY_CONF environmental variable is checked next.
If neither are set, PHP will look in the default certificate area that
was set
at the time that the SSL DLLs were compiled. This is typically
"C:\usr\local\ssl\openssl.cnf".

If the default path is not suitable for your system, you can set the
OPENSSL_CONF variable; under windows 95 and 98 you can set this variable in
your autoexec.bat (or the batch file that starts your webserver/PHP).
Under NT, 2000 and XP you can set environmental variables using "My
Computer"
properties.

If setting an environmental var is not suitable, and you don't want to
install
the config file at the default location, you can override the default path
using code like this:

$configargs = array(
"config" => "path/to/openssl.cnf"
);

$pkey = openssl_pkey_new($config);
$csr = openssl_csr_new($dn, $pkey, $config);

Please consult the online manual for more information about these functions.

NOTE!

Windows Explorer gives special meaning to files with a .cnf extension.
This typically means that editing the file from the explorer (by double or
right-clicking) will be difficult or impossible depending on your setup.
It is often easier to open the file from within the editor.
You can avoid this issue by naming the file something else (you might
need to
rename the file using a DOS box) and then setting up an environmental
variable
as described above.
--
Mike Willbanks
Zend Certified Engineer
http://www.digitalstruct.com
Oct 13 '05 #4
Thanks for getting back again, Mike.
Chuck,
have found nothing about setting environment variables. ?? Do I need
to do something more in php (php.ini) or in Apache httpd.conf?

This is what is contained in the readme-ssl.txt file (php4):

To use the CSR and key generation functions from PHP, you will need to
install an openssl.cnf file. We have included a sample file that can be used
for this purpose in this folder alongside this readme file.

The default path for the openssl.cnf file is determined as follows:

OPENSSL_CONF environmental variable, if set, is assumed to hold the
path to the file.

The compiled binary installer for openSSL did set this environment variable.

I'm really stumped here. I seem to have everything I need to get Php to
allow me to open https streams, but it is just not happening.

I downloaded and installed the latest Php4 for Windows from php.net and
it is working. If I call get_loaded_extensions, I see:

Array
(
[0] => standard
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => com
[5] => ftp
[6] => mysql
[7] => odbc
[8] => overload
[9] => pcre
[10] => session
[11] => tokenizer
[12] => xml
[13] => wddx
[14] => zlib
[15] => apache
[16] => curl
[17] => gd
[18] => mhash
[19] => openssl
)

So the openssl extension is loaded.

The Windows environment variable OPENSSL_CONF is set to
C:\OpenSSL\bin\openssl.cnf (and that is where I have installed OpenSSL.
The two necessary dll files are in my Windows/System32 folder
(libeay32.dll and ssleay32.dll).

And lastly - running php -m (show compiled in modules) from a command
prompt displays:

[PHP Modules]
bcmath
calendar
com
ctype
curl
ftp
gd
mhash
mysql
odbc
openssl
overload
pcre
session
standard
tokenizer
wddx
xml
zlib

So the openssl module is compiled in my copy of Php.

Still, when I do Phpinfo, I get:
Registered PHP Streams - php, http, ftp, compress.zlib

No https and no ftps.

I have run Php as CGI and as an Apache module and it makes no difference.

I can not find anything else to check (open_basedir is not set), so
....... I am stumped.

I can not get https and ftps to be registered streams and it appears
that I have done everything needed to do so. ??

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
Oct 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Generic Usenet Account | last post by:
I am trying to create a Java application that reads a list of URLs from a file and stores their contents on the local file system. I have succeeded in accessing normal websites, but I am unable to...
3
by: Pooja Renukdas | last post by:
Hello, I have this web site where only two pages have to be secure pages and I need to call them using https, but since I have my development server and my production web server, I dont want to...
7
by: Brian Henry | last post by:
I created a project and it looks like everything is loading under HTTPS on all the pages perfectly except one page that it loads saying that the page contains both secure and non secure items......
1
by: Charles A. Lackman | last post by:
Hello, I have a web site that has a single page secured using SSL. This page also has Flash Macromedia header on it, Does this cause a conflict? When you visit the site it says, "This page...
2
by: Ron Weldy | last post by:
In the past, I have always handled secure sections of websites using IIS. You put the files you want to transfer data securely in a folder and you indicate that in IIS. If you really need to force...
7
by: VB Programmer | last post by:
I created an ASP.NET website and recently got a secure certificate. Whenever I visit any of the pages IE says "This page contains both secure and nonsecure items. Do you want to display the...
0
by: tmai | last post by:
How to bypass a SSL cerificate programmactially (automatically so a user does not need to know how to do it) when open a secure URL? For example when opening a secure URL, a SSL security certificate...
0
by: amitvps | last post by:
Secure Socket Layer is very important and useful for any web application but it brings some problems too with itself. Handling navigation between secure and non-secure pages is one of the cumbersome...
3
by: tshad | last post by:
I have a problem with a page I am trying to secure. It has a flash object as well as a couple of 3rd party objects used for tracking use of the page. I keep getting a message saying that there are...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.