{"id":1039,"date":"2012-11-05T17:01:25","date_gmt":"2012-11-05T17:01:25","guid":{"rendered":"http:\/\/brain.payzip.co.kr\/?p=1039"},"modified":"2012-11-05T17:01:25","modified_gmt":"2012-11-05T17:01:25","slug":"how-to-install-a-php-pecl-extensionmodule-on-ubuntu","status":"publish","type":"post","link":"https:\/\/blog.goorigo.com\/?p=1039","title":{"rendered":"How to install a PHP PECL extension\/module on Ubuntu"},"content":{"rendered":"<p><a href=\"http:\/\/www.mkfoster.com\/2009\/01\/04\/how-to-install-a-php-pecl-extensionmodule-on-ubuntu\/\">http:\/\/www.mkfoster.com\/2009\/01\/04\/how-to-install-a-php-pecl-extensionmodule-on-ubuntu\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>PHP\u00a0<a href=\"http:\/\/pecl.php.net\/\">PECL<\/a>\u00a0extensions provide additional functionality over the base PHP install. You can browse the PHP PECL extensions available at the PECL repository\u00a0<a href=\"http:\/\/pecl.php.net\/packages.php\">here<\/a>. The following steps show how to install a PECL extension\/module on Ubuntu using the\u00a0<a href=\"http:\/\/pecl.php.net\/package\/pecl_http\">PECL_HTTP<\/a>\u00a0extension as an example and assumes that you already have Apache 2 and PHP 5 installed:<\/p>\n<ul>\n<li>First, you will need to install PEAR via\u00a0<a href=\"http:\/\/www.debian.org\/doc\/manuals\/apt-howto\/\">apt-get<\/a>\u00a0to get the necessary package and distribution system that both PEAR and PECL use. From a shell prompt enter:\n<div>sudo apt-get install php-pear<\/div>\n<p>You will be prompted to confirm the install. Just press \u201cy\u201d and enter. If all goes well you should see it download and install the php-pear package.<\/p>\n<div>Note: \u201c<a href=\"http:\/\/en.wikipedia.org\/wiki\/Sudo\">sudo<\/a>\u201d is used to provide the super user privileges necessary for the following command. So in this case the command \u201capt-get install php-pear\u201d is being executed with super user privileges by preceding it with \u201csudo\u201d. Unless configured otherwise, you will normally be prompted to enter a password when you use sudo. This is usually the same password that you logged in with.<\/div>\n<\/li>\n<li>Now you will need to install the\u00a0<a href=\"http:\/\/packages.ubuntu.com\/dapper\/devel\/php5-dev\">php5-dev<\/a>\u00a0package to get the necessary PHP5 source files to compile additional modules. Enter the following from a shell prompt:\n<div>sudo apt-get install php5-dev<\/div>\n<p>If you do not install the php5-dev package and try to install a PECL extension using \u201cpear install\u201d, you will get the following error:<\/p>\n<div>sh: phpize: not found<br \/>\nERROR: `phpize\u2019 failed<\/div>\n<\/li>\n<li>The PECL_HTTP extension requires an additional dependency package to be installed. You can probably skip this for other extensions:\n<div>sudo apt-get install libcurl3-openssl-dev<\/div>\n<\/li>\n<li>Now we are finally ready to actually install the extension. From a shell prompt enter following but substitute \u201cpecl_http\u201d with the PECL extension name you are installing:\n<div>sudo pecl install pecl_http<\/div>\n<p>The installer may ask you about some specific options for the extension you are installing. You can probably just hit enter one or more times to accept all the defaults unless you want to set specific options for your implementation. If all goes well, the module should download, build, and install.<\/li>\n<li>Once the install is complete, it will probably ask you to add a \u201cextension=\u201d line to your php.ini file. Open up the php.ini file in your favorite text editor and add the line under the section labeled \u201cDynamic Extensions\u201d. On Ubuntu the php.ini file seems to be located in the \/etc\/php5\/apache2 folder:\n<div>sudo nano\u00a0\/etc\/php5\/apache2\/php.ini<\/div>\n<p>In this example, the pecl_http extension install asked me to add \u201cextension=http.so\u201d.<\/li>\n<li>Now that the php.ini file has been updated, Apache will need to be restarted so the new extension will be loaded:\n<div>sudo \/etc\/init.d\/apache2 restart<\/div>\n<p>That should restart Apache on Ubuntu but if that doesn\u2019t work you can try:<\/p>\n<div>sudo \/etc\/init.d\/httpd restart<\/div>\n<\/li>\n<\/ul>\n<p>If all went well your PECL extension should now be working. You might want to write a PHP test page that will test the basic functionality of the extension to make sure everything is working OK. You can use this later to check that all your required extensions are installed and working when you deploy to a new server. In this example where I installed the PECL_HTTP module, I might write a PHP page that uses the extension\u2019s HttpRequest class to go get a page and return the results.<\/p>\n<p>That\u2019s it. For the next extension install you can skip the steps to install the php-pear and php5-dev packages.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/www.mkfoster.com\/2009\/01\/04\/how-to-install-a-php-pecl-extensionmodule-on-ubuntu\/ &nbsp; &nbsp; PHP\u00a0PECL\u00a0extensions provide additional functionality over the base PHP install. You can browse the PHP PECL extensions available at the PECL repository\u00a0here. The following steps show how to&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts\/1039"}],"collection":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1039"}],"version-history":[{"count":0,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts\/1039\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}