{"id":46,"date":"2009-05-11T10:24:24","date_gmt":"2009-05-11T17:24:24","guid":{"rendered":"http:\/\/kai.mactane.org\/blog\/?p=46"},"modified":"2009-09-30T11:35:59","modified_gmt":"2009-09-30T18:35:59","slug":"workaround-for-pearpecl-failure-with-message-error-phpize-failed","status":"publish","type":"post","link":"https:\/\/kagan.mactane.org\/blog\/2009\/05\/11\/workaround-for-pearpecl-failure-with-message-error-phpize-failed\/","title":{"rendered":"Workaround for PEAR\/PECL Failure with Message &#8220;ERROR: `phpize&#8217; failed&#8221;"},"content":{"rendered":"<p>When you try to upgrade or install various PEAR (or PECL) packages, you may get the rather unhelpful error message &#8220;ERROR: `phpize&#8217; failed&#8221;. For example, here&#8217;s the result I get when I try to install the <code>pecl_http<\/code> package:<\/p>\n<p><code>root@finrod:~# <strong>pecl install pecl_http<\/strong><br \/>\npecl\/pecl_http can optionally use PHP extension &#34;iconv&#34;<br \/>\ndownloading pecl_http-1.6.3.tar .&#46;.<br \/>\nStarting to download pecl_http-1.6.3.tar (Unknown size)<br \/>\n.&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;.&#46;.<br \/>\n.&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;.&#46;.<br \/>\n.&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;..&#46;.&#46;.done: 1,015,808 bytes<br \/>\n71 source files, building<br \/>\nrunning: phpize<br \/>\nConfiguring for:<br \/>\nPHP Api Version:         20041225<br \/>\nZend Module Api No:      20060613<br \/>\nZend Extension Api No:   220060519<br \/>\nERROR: `phpize&#39; failed<br \/>\nroot@finrod:~#<\/code><\/p>\n<p>The error is actually caused by <a href=\"http:\/\/bugs.php.net\/bug.php?id=29123\">a bug in PHP itself (filed in PHP&#8217;s bug database as of 2004<\/a>, and currently marked &#8220;Won&#8217;t fix&#8221;): If your installation of PHP was compiled with the <code>--enable-sigchild<\/code> flag on, then the return value from a <code>pclose()<\/code> call can&#8217;t be trusted. One of PEAR&#8217;s components, called PEAR::Builder, uses <code>pclose()<\/code> as part of the package installation process, to try to determine whether a given operation succeeded or not.<\/p>\n<p>Even though the operation succeeds, <code>pclose()<\/code> returns -1, signaling a failure, and the rest of PEAR then takes <code>pclose()<\/code> at its word.<\/p>\n<p><strong>Is This Affecting Your Installation of PHP and PEAR?<\/strong><\/p>\n<p>If you&#8217;ve gotten an &#8220;ERROR: `phpize&#8217; failed&#8221; message when trying to run a &#8220;pecl install&#8221; or &#8220;pear install&#8221; command, try running <code>phpinfo()<\/code>&nbsp;&mdash; if you see <code>--enable-sigchild<\/code> in the &#8220;Configure Command&#8221; section near the very top, then you&#8217;re most likely being bitten by this bug.<\/p>\n<p><strong>Potential Fixes and Workarounds<\/strong><\/p>\n<p>The PHP dev team recommends recompiling without the offending flag.<\/p>\n<p>However, you may not be able to do that, for any of various reasons. (You may have installed from a binary package, for instance&nbsp;&mdash; like most people these days.) Or it may simply seem like an excessive hassle. I offer the following patch <strong>as-is, without any guarantee or support<\/strong>.<\/p>\n<p>First, ensure that you have the latest version of PEAR::Builder. Look in your PEAR\/Builder.php file&nbsp;&mdash; On most Linux and Unix installations, this is likely to be in <code>\/usr\/lib\/php\/PEAR\/Builder.php<\/code>, or possibly <code>\/usr\/local\/lib\/php\/PEAR\/Builder.php<\/code>.<\/p>\n<p>On Windows systems, PHP might be installed nearly anywhere, but supposing it&#8217;s in <code>c:\\php<\/code>, then the file you&#8217;re looking for will be in <code>c:\\php\\PEAR\\PEAR\\Builder.php<\/code> (yes, that&#8217;s two PEARs in a row).<\/p>\n<p>Check the &#8220;@version&#8221; line in the big comment block at the beginning of the file; the line you want should be around line 19 or so. If says it&#8217;s less than version 1.38 (the latest one, at the time I&#8217;m writing this post), then try upgrading. Running &#8220;pear upgrade pear&#8221; should work. Then you can install this patch file:<\/p>\n<p><a href=\"http:\/\/kai.mactane.org\/software\/patch-pear-builder-1.38.txt\">patch-pear-builder-1.38.txt<\/a><\/p>\n<p>Download the patch file and place it somewhere on your machine. Log in and <code>cd<\/code> to the PEAR directory that contains the Builder.php file. Then run the patch command. In the following example, I&#8217;ve placed the patch file in root&#8217;s home directory:<\/p>\n<p><code>root@finrod:~# <strong>ls<\/strong><br \/>\nloadlin16c.txt  loadlin16c.zip  patch-pear-builder-1.38.txt<br \/>\nroot@finrod:~# <strong>cd \/usr\/lib\/php\/PEAR<\/strong><br \/>\nroot@finrod:\/usr\/lib\/php\/PEAR# <strong>cp Builder.php Builder.bak.php<\/strong><br \/>\nroot@finrod:\/usr\/lib\/php\/PEAR# <strong>patch -p0 < \/root\/patch-pear-builder-1.38.txt<\/strong><br \/>\npatching file Builder.php<br \/>\nroot@finrod:\/usr\/lib\/php\/PEAR# <\/code><\/p>\n<p>Naturally, if the patch file doesn&#8217;t work for some reason, or it breaks things, you can just <code>cp<\/code> the backup file back into place.<\/p>\n<p>Please let me know if this patch works for you&nbsp;&mdash; or if it fails horribly, for that matter.<\/p>\n<p>[Updated 2009-06-03: Minor edits for clarity]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you try to upgrade or install various PEAR (or PECL) packages, you may get the rather unhelpful error message &#8220;ERROR: `phpize&#8217; failed&#8221;. For example, here&#8217;s the result I get when I try to install the pecl_http package: root@finrod:~# pecl install pecl_http pecl\/pecl_http can optionally use PHP extension &#34;iconv&#34; downloading pecl_http-1.6.3.tar .&#46;. Starting to download [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[44,50,49,5,51,74],"_links":{"self":[{"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/posts\/46"}],"collection":[{"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":10,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":133,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions\/133"}],"wp:attachment":[{"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}