| Author |  | 
| mightyspawn 
 
 
 Joined: 26 May 2006
 Posts: 18
 
 
 | 
|  Posted: Fri 26 May '06 22:51    Post subject: how to turn openssl on in php? |   |  
| 
 |  
| Well, i dont know if i should be here for this question. But ill ask. 
 I have downloaded the latest php 5.1.4, replaced the php dll with the one on this site.
 
 Then i switched the openssl module on
 
 this is what phpinfo() shows me:
 
 
  	  | Quote: |  	  | Registered Stream Socket Transports 	tcp, udp, ssl, sslv3, sslv2, tls openssl
 OpenSSL support 	enabled
 OpenSSL Version 	OpenSSL 0.9.8a 11 Oct 2005
 | 
 
 Then i tried the next scrip from the php.net website
 http://de3.php.net/manual/en/function.ftp-ssl-connect.php
 
 
  	  | Code: |  	  | <?php 
 // set up basic ssl connection
 $conn_id = ftp_ssl_connect($ftp_server);
 
 // login with username and password
 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 
 echo ftp_pwd($conn_id); // /
 
 // close the ssl connection
 ftp_close($conn_id);
 ?>
 | 
 Then i get this error:
 
  	  | Quote: |  	  | Fatal error: Call to undefined function ftp_ssl_connect() in C:\site\index.php on line 4 | 
 So it seems its not working correctly at the moment, but why does PHP tells me it is.
 
 What should i do to get it working?
 
 I've put phpinidir in httpd.conf
 
 So i dont have to copy libeay32.dll ssleay32.dll to system32 directory. I tried it nonetheless, but without any results.
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 |  | 
| Back to top |  | 
| mightyspawn 
 
 
 Joined: 26 May 2006
 Posts: 18
 
 
 | 
|  Posted: Fri 26 May '06 23:49    Post subject: |   |  
| 
 |  
| yeah this link http://ftp.emini.dk/pub/php/win32/openssl/
 but only solution for php 4.x
 
 How do i compile my own php 5.1.4 with ssl?
 
 Ok i found this topic
 http://www.apachelounge.com/viewtopic.php?t=138
 
 with the next reply
 
 
  	  | Steffen wrote: |  	  | Indeed there is more to it, to get it build with VC 2005. 
 I spend tons of time to get the wright (up-to-date) external libraries, includes and header files.
 
 I managed now that I can build php 5+ without any change to the php source.
 
 As this subject is off-topic, you can mail me for more info.
 
 Steffen
 | 
 
 I will contact Steffen, because its kinda off topic.
 |  | 
| Back to top |  | 
| Steffen Moderator
 
 
 Joined: 15 Oct 2005
 Posts: 3130
 Location: Hilversum, NL, EU
 
 |  | 
| Back to top |  | 
| mightyspawn 
 
 
 Joined: 26 May 2006
 Posts: 18
 
 
 | 
|  Posted: Sun 28 May '06 21:29    Post subject: |   |  
| 
 |  
| thanks man, i gonna try it right now. |  | 
| Back to top |  | 
| mightyspawn 
 
 
 Joined: 26 May 2006
 Posts: 18
 
 
 | 
|  Posted: Sun 28 May '06 21:44    Post subject: |   |  
| 
 |  
| ok, got it up running. phpmyinfo shows its up. net2ftp shows the SSL checkbox (so he knows its working). But when i try to login to the Secure FTP server. It gives me this error. 
 SSL/TLS handshake failed
 
 The secure ftp server works fine under flashfxp
 
 Do i have anything to do with the openssl.cnf file? Or something?
 
 edit: Oke i have to do something with the certificates ive created. There are 2 files. A .crt and .key file. Do i have to put them somewhere in php directory or apache directory?
 
 Last edited by mightyspawn on Sun 28 May '06 22:25; edited 1 time in total
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Sun 28 May '06 22:16    Post subject: |   |  
| 
 |  
|  	  | Code: |  	  | Listen 443
 
 LoadModule ssl_module modules/mod_ssl.so
 
 ErrorLog "/server2/logs/ssl.error.log"
 TransferLog "/server2/logs/ssl.access.log"
 #   Enable/Disable SSL for this virtual host.
 SSLEngine on
 
 SSLCertificateFile "/server2/apache/conf/ssl.crt/server.crt"
 SSLCertificateKeyFile "/server2/apache/conf/ssl.key/server.key"
 
 | 
 |  | 
| Back to top |  | 
| mightyspawn 
 
 
 Joined: 26 May 2006
 Posts: 18
 
 
 | 
|  Posted: Sun 28 May '06 22:46    Post subject: |   |  
| 
 |  
| But that is for the secure websiteconnection. What i want, is only to make a secure connection from the server (php) with the FTP server. The connection to the website is nonsecure. 
 webbrowser -<nonsecure>-server-<secure>ftp
 
 In my ftp client i have to accept the certifacte, So i think i have to do something with the certificate. Otherwise i have no clue how to get it working.
 |  | 
| Back to top |  | 
| mightyspawn 
 
 
 Joined: 26 May 2006
 Posts: 18
 
 
 | 
|  Posted: Mon 29 May '06 16:46    Post subject: |   |  
| 
 |  
| Here the complete error i recieve: 
 
  	  | Quote: |  	  | Warning: ftp_login() [function.ftp-login]: SSL/TLS handshake failed in xxxxxx\filesystem.inc.php on line 56
 
 Warning: ftp_login() [function.ftp-login]: AUTH command ok; starting SSL connection. in xxxxxx\filesystem.inc.php on line 56
 
 | 
 
 Seems like it connects but with the handshaking its going wrong
 |  | 
| Back to top |  | 
| mightyspawn 
 
 
 Joined: 26 May 2006
 Posts: 18
 
 
 | 
|  Posted: Tue 30 May '06 11:56    Post subject: |   |  
| 
 |  
| Could this has something to do with it? 
 
  	  | Quote: |  	  | PHP Warning:  PHP Startup: Unable to load dynamic library 'c:\\php\\ext\\php_mcrypt.dll' - The specified module could not be found.\r\n in Unknown on line 0 | 
 
 Or doesnt ssl use mcrypt?
 |  | 
| Back to top |  | 
| deciacco 
 
 
 Joined: 09 Oct 2007
 Posts: 1
 
 
 | 
|  Posted: Tue 09 Oct '07 4:20    Post subject: |   |  
| 
 |  
| UPDATE: 
 I think I found a solution to this. For more information, see my post here:
 http://www.deciacco.com/blog/archives/124
 
 This is a long shot since it's been so long...
 
 Were you ever able to get this working. I was able to compile php with openssl, but I get the same "handshake failed" message. I'm able to use ftp_ssl_connect, but when I try to use ftp_login it fails. The server shows ssl_error_ssl - wrong version number.
 
 I compiled php 5.2 with vc6.
 
 Thanks!
 |  | 
| Back to top |  | 
| Jaking 
 
 
 Joined: 10 Mar 2008
 Posts: 4
 
 
 | 
|  Posted: Mon 10 Mar '08 5:07    Post subject: |   |  
| 
 |  
| Anyone has knows where can I find a compiled version of php+openssl ? So the use of ftp_ssl_connect becomes possible? 
 I'v waste days looking for a solution fr this...
   
 thanks
 |  | 
| Back to top |  |