{"id":150,"date":"2015-10-09T17:20:37","date_gmt":"2015-10-09T09:20:37","guid":{"rendered":"http:\/\/www.zhuyanbin.com\/?p=150"},"modified":"2016-01-09T21:40:24","modified_gmt":"2016-01-09T13:40:24","slug":"how-to-compile-php-with-openssl-on-os-x-10-9","status":"publish","type":"post","link":"https:\/\/www.yanbin888.com\/?p=150","title":{"rendered":"How to compile PHP with OpenSSL on OS X 10.9?"},"content":{"rendered":"<p>I&#8217;m trying to compile PHP 5.6.10 from the source, and I encountered the following problem:<\/p>\n<pre><code class=\" hljs python\">Undefined symbols <span class=\"hljs-keyword\">for<\/span> architecture x86_64:\r\n  <span class=\"hljs-string\">\"_PKCS5_PBKDF2_HMAC\"<\/span>, referenced <span class=\"hljs-keyword\">from<\/span>:\r\n      _zif_openssl_pbkdf2 <span class=\"hljs-keyword\">in<\/span> openssl.o\r\n  <span class=\"hljs-string\">\"_TLSv1_1_client_method\"<\/span>, referenced <span class=\"hljs-keyword\">from<\/span>:\r\n      _php_openssl_setup_crypto <span class=\"hljs-keyword\">in<\/span> xp_ssl.o\r\n  <span class=\"hljs-string\">\"_TLSv1_1_server_method\"<\/span>, referenced <span class=\"hljs-keyword\">from<\/span>:\r\n      _php_openssl_setup_crypto <span class=\"hljs-keyword\">in<\/span> xp_ssl.o\r\n  <span class=\"hljs-string\">\"_TLSv1_2_client_method\"<\/span>, referenced <span class=\"hljs-keyword\">from<\/span>:\r\n      _php_openssl_setup_crypto <span class=\"hljs-keyword\">in<\/span> xp_ssl.o\r\n  <span class=\"hljs-string\">\"_TLSv1_2_server_method\"<\/span>, referenced <span class=\"hljs-keyword\">from<\/span>:\r\n      _php_openssl_setup_crypto <span class=\"hljs-keyword\">in<\/span> xp_ssl.o\r\nld: symbol(s) <span class=\"hljs-keyword\">not<\/span> found <span class=\"hljs-keyword\">for<\/span> architecture x86_64\r\nclang: error: linker command failed <span class=\"hljs-keyword\">with<\/span> exit code <span class=\"hljs-number\">1<\/span> (use -v to see invocation)\r\nmake: *** [libs\/libphp5.bundle] Error <span class=\"hljs-number\">1<\/span>\r\n<\/code><\/pre>\n<p>OpenSSL is installed via Brew. In PHP included like <code>--with-openssl=\/usr\/local\/Cellar\/openssl\/1.0.2c<\/code><\/p>\n<p>P.S. Before tried to use just <code>\/usr<\/code> for OpenSSL but got the same error.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"soAnswer\">\n<div class=\"soDarkText\">\n<div class=\"post-text\">\n<p>The Makefile has a line with <code>EXTRA_LIBS<\/code>, something like:<\/p>\n<pre><code class=\" hljs ini\"><span class=\"hljs-setting\">EXTRA_LIBS = <span class=\"hljs-value\">-lresolv -lmcrypt -lltdl -liconv-lm -lxml2 -lcurl -lssl -lcrypto<\/span><\/span>\r\n<\/code><\/pre>\n<p>Remove all occurrences of <code>-lssl<\/code> and <code>-lcrypto<\/code> and add the full path to <code>libssl.dylib<\/code> and <code>libcrypto.dylib<\/code> <em>(brew links openssl to \/usr\/local\/opt\/openssl\/lib\/)<\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div>EXTRA_LIBS = -lresolv -lexslt -ltidy -lmysqlclient -lmcrypt -lltdl \/usr\/local\/lib\/libiconv.dylib \/usr\/local\/Cellar\/openssl\/1.0.2d_1\/lib\/libssl.dylib \/usr\/local\/Cellar\/openssl\/1.0.2d_1\/lib\/libcrypto.dylib -lpng -lz -ljpeg -lcurl -lbz2 -lz \u00a0-lm -lxml2 -lz -licucore -lm -lcurl -lldap -lz -lxml2 -lz -licucore -lm -lfreetype -lmysqlclient -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxslt -lxml2 -lz -licucore -lm<\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to compile PHP 5.6.10 from the source, <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"https:\/\/www.yanbin888.com\/?p=150\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[6,22],"class_list":["post-150","post","type-post","status-publish","format-standard","hentry","category-php","tag-mac-os-x","tag-php"],"_links":{"self":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=150"}],"version-history":[{"count":4,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/150\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}