SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    OpenSSL enabled but not working

    I am exhausted on searching for the answer so I am finally submitting a post. I am running Apache 2.2.13 and PHP 5.2.12. Just installed PHP 5.2.12 manually and enabled OpenSSL. phpinfo() indicates OpenSSL is enabled and running OpenSSL 0.9.8k 25 Mar 2009.

    I'm getting this error: PHP Fatal error: Call to undefined function ftp_ssl_connect().

    I even tried installing OpenSSL from GnuWin32 for Apache. I've seen where the PHP manual suggests 'ftp_ssl_connect() is only available if both the ftp module and the OpenSSL support is built statically into php' and further states that 'you must compile your own PHP binaries' to make it work with Windows.

    I can't figure out exactly how to 'compile' my own PHP binaries to make this work. I have the suspicion that phpinfo() only indicates OpenSSL as being 'enabled' because I have uncommented the line 'extension=php_openssl.dll' and have the correct dlls in the correct folders and the correct path in the environment variables. And perhaps a static build into PHP must be accomplished regardless of what phpinfo() indicates.

    Can I get any help on this?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mjpsr11 View Post
    I can't figure out exactly how to 'compile' my own PHP binaries to make this work.
    Compiling means creating an executable program from source code. In this case, it's the C source code the PHP interpreter is written in, and you need a program called a compiler to turn it into an executable. You'll also need to understand how to change which extensions are part of your compile script. You'll need to download the source code for PHP and compile it with something like Visual Studio. If this is beyond what you're prepared for maybe you should look into other options than using PHP for secure FTP connections? Like a command line utility, or some other method of transferring whatever files you're transferring? What are you using it for?

  3. #3
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that quick reply. No problem compiling and editing source, just wondering why PHP is distributed with extension libraries (libeay32.dll, ssleay32.dll), instructions on making sure path environment variables are correct, and even commented lines ready in php.ini without much value. If I have to download PHP source and compile it, I surely am resourceful enough to find the libraries I need for the extension I want. Was hoping it would be a little easier.

    I believe the objective of distribution (as described above) is for dynamic extensions, but recompiling (for OpenSSL) is to encode a static extension. The distribution kinda doesn't make sense if this is the case (why go to all the trouble and not just make reference in the readme).

    BTW, do you agree that phpinfo() indicates enabled only because php.ini (and perhaps my environment variables) are correct? Do you really have to make the extension static? Why not dynamic?

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I don't know, have you verified that the FTP extension is installed? Maybe use some function it provides that doesn't require SSL to test?

    If you're only downloading and not uploading, you might bypass this all by using filesystem functions and the ftp:// protocol wrapper which should be enabled by default

  5. #5
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, ftp extension is working fine (built into PHP 5.2). I test this with the following code:

    $conn_id = ftp_connect($url);
    $login_result = ftp_login($conn_id, $username, $password);
    echo ftp_pwd($conn_id); // /
    ftp_close($conn_id);

    Note that to check ssl, I only change ftp_connect to ftp_ssl_connect. When reaching this line, I get the PHP error in my Apache error log file. Just not comfortable sending passwords over unsecured connections.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •