{"id":62,"date":"2009-09-24T14:36:14","date_gmt":"2009-09-24T21:36:14","guid":{"rendered":"http:\/\/adam.yanalunas.com\/blog\/?p=62"},"modified":"2011-08-22T13:30:44","modified_gmt":"2011-08-22T20:30:44","slug":"making-snow-leopards-php-5-3-0-usable-in-the-real-world","status":"publish","type":"post","link":"http:\/\/adam.yanalunas.com\/blog\/archives\/62","title":{"rendered":"Making Snow Leopard&#8217;s PHP 5.3.0 usable in the real world"},"content":{"rendered":"<h2>Update:<\/h2>\n<p>It has been a while since I originally posted this article and somethings have changed. Marc Liyanage has posted his <a href=\"http:\/\/www2.entropy.ch\/download\/Entropy%20PHP%205.3.0-3.pkg\">custom PHP 5.3.0 build<\/a> and, as noted by a comment from Sam, <a href=\"http:\/\/adam.yanalunas.com\/blog\/archives\/62\/comment-page-1#comment-6991\">a simple flag would have helped a lot<\/a>. So&hellip;carry on.<\/p>\n<hr style=\"height: 1px; border: none; background: #999;\" \/>\n<p>As of writing the standard 5.2.x <a href=\"http:\/\/www.entropy.ch\/software\/macosx\/php\/\">Entropy package<\/a> from <a href=\"http:\/\/www.entropy.ch\/\">Marc Liyanage<\/a> does not work with 10.6. This means either a custom compile of PHP 5.2.x and the required extensions or piggybacking the default 5.3.0 install. After spending a few days attempting trying to modify the existing Entropy install, trying to build new plug-ins against it and many other techniques it became clear that the quickest path back to development was to used the 5.3.0 install and provide the missing plug-ins.<\/p>\n<h3>What&#8217;s missing with the 5.3.0 install<\/h3>\n<p>The default Apple install provides many nice plug-ins but thus far there have been a few critical ones noted as missing which require building on your own machine and installing into your PHP&#8217;s extension directory. The process is the same for each of these but will be tackled on a one-by-one basis.<\/p>\n<h3>Preparaing your environment to build extensions<\/h3>\n<p>Compiling PHP extensions is easy, requiring only the PHP source from <a href=\"http:\/\/www.php.net\/\">php.net<\/a>. Download the <a href=\"http:\/\/us.php.net\/downloads.php\">PHP source<\/a> using your browser, cURL or another available method as Snow Leopard lacks <code>wget<\/code>. Extract the code to a temporary directory, such as <code>~\/source_files\/php<\/code>. Although 10.6 is a 64-bit environment these will be four way builds, just in case Apache, PHP or any other environment calls for 32-bit compiles.<\/p>\n<p>Set up your arguments environment with this command:<\/p>\n<pre>CFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64'\r\nLDFLAGS='-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64'\r\nCXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64'<\/pre>\n<h3>libmcrypt<\/h3>\n<p>Download the latest version of libmcrypt from <a href=\"http:\/\/sourceforge.net\/projects\/mcrypt\/files\/Libmcrypt\/2.5.8\/libmcrypt-2.5.8.tar.bz2\/download\">SourceForge<\/a> and unpack into <code>~\/source_files\/libmcrypt<\/code>. Execute the build with these commands:<\/p>\n<pre>cd ~\/source_files\/libmcrypt\/\r\n.\/configure --disable-posix-threads --disable-shared\r\nmake\r\nsudo make install\r\n<\/pre>\n<p>With libmcrypt properly built and installed in the system all that&#8217;s left is building the code provided in the PHP source.<\/p>\n<h3>mhash<\/h3>\n<pre>cd ~\/source_files\/php\/ext\/mhash\r\nphpize\r\n.\/configure\r\nmake\r\nsudo make install\r\n<\/pre>\n<h3>mcrypt<\/h3>\n<pre>cd ~\/source_files\/php\/ext\/mcrypt\r\nphpize\r\n.\/configure\r\nmake\r\nsudo make install\r\n<\/pre>\n<h3>mssql<\/h3>\n<p>I have not yet attempted an MSSQL extension compilation but I can already assume you&#8217;ll need to download <a href=\"http:\/\/www.freetds.org\/\">FreeTDS<\/a> before starting. Anybody who gets this done should do us all a favor and post something in the comments.<\/p>\n<h2>See also:<\/h2>\n<ul>\n<li><a href=\"http:\/\/discussions.apple.com\/thread.jspa?threadID=2141886&#038;tstart=0\" target=\"_blank\">Segmentation faults? Blame MySQL using port 0 to connect<\/a><\/li>\n<li><a href=\"http:\/\/lisaandroger.com\/2009\/08\/upgrading-to-mac-os-x-10-6-snow-leopard\/\" target=\"_blank\">Notes from another 10.6 upgrade process<\/a><\/li>\n<li><a href=\"http:\/\/docs.moodle.org\/en\/Installing_MSSQL_for_PHP\" target=\"_blank\">Straightforward doc on getting FreeTDS installed<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Update: It has been a while since I originally posted this article and somethings have changed. Marc Liyanage has posted his custom PHP 5.3.0 build and, as noted by a comment from Sam, a simple flag would have helped a lot. So&hellip;carry on. As of writing the standard 5.2.x Entropy package from Marc Liyanage does [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,5],"tags":[],"_links":{"self":[{"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/posts\/62"}],"collection":[{"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/comments?post=62"}],"version-history":[{"count":6,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/posts\/62\/revisions"}],"predecessor-version":[{"id":66,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/posts\/62\/revisions\/66"}],"wp:attachment":[{"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/media?parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/categories?post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/tags?post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}