Thank you, MacPorts: How to add OpenSSL support to your PHP

Many interesting web APIs require SSL, for instance Google’s GData API. This adds OpenSSL support to your MacPorts-installed PHP, so that you can use the “ssl” transport layer:

sudo port install php5-openssl

Done.

Thanks, jmr_mp in the MacPorts IRC channel, for telling me about the existence of this short and neat patch-applying port, so that I could spare you, dear reader, from an introductory tutorial on how to edit Portfiles that don’t add the bells and whistles that you want. I had one written, but the above is saner. There’s always another hood underneath the hood. You don’t have to fix everything. Some things should just be fixed by the package system.

Here’s that Portfile:

$ port cat php5-openssl
# $Id: Portfile 69619 2010-07-11 03:00:23Z ryandesign@macports.org $

PortSystem              1.0
PortGroup               php5extension 1.0

php5extension.setup     openssl 5.3.2 bundled
revision                1
categories-append       devel security
platforms               darwin
maintainers             ryandesign

description             a PHP interface to OpenSSL signature-generation \
                        and -verification and data-encryption and \
                        -decryption functions

long_description        ${description}

checksums               md5     46f500816125202c48a458d0133254a4 \
                        sha1    79ea4ee3da3a7542d1e348ac963a5b38bcbb4b6b \
                        rmd160  60a8aac0d51511ecaf8dcad9d31bdf072c0c99cf

depends_lib-append      port:openssl

post-extract {
    move ${build.dir}/config0.m4 ${build.dir}/config.m4
}

configure.args-append   --with-openssl=${prefix}

platform macosx {
    configure.args-append --with-kerberos=/usr
}

use_parallel_build      yes

Published by olleolleolle

Olle is a programmer, enjoying sunny Malmö in Sweden.

Join the Conversation

2 Comments

  1. Thanks Olle! Was just configuring MacPorts to play well with Roots/Bedrock for WordPress development and hit a snag as I did not have the openssl port installed to download the needed packages : Failed to download vlucas/phpdotenv from dist: You must enable the openssl extension to download files via https The command sudo port install php55-openssl sorted things very nicely!

  2. (It was 2 years and 2 months since a human with non-spam intent used the commenting function on this website. This calls for something of a celebration. Huzzah, Jasper!)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.