{"id":149,"date":"2013-12-26T06:01:12","date_gmt":"2013-12-26T10:01:12","guid":{"rendered":"https:\/\/www.grumpyland.com\/blog\/?p=149"},"modified":"2013-12-26T06:02:37","modified_gmt":"2013-12-26T10:02:37","slug":"installing-the-latest-php-5-4-23-5-5-7-on-centosrhel","status":"publish","type":"post","link":"https:\/\/www.grumpyland.com\/blog\/149\/installing-the-latest-php-5-4-23-5-5-7-on-centosrhel\/","title":{"rendered":"Installing the latest PHP (5.4.23 \/ 5.5.7) on CentOS\/RHEL"},"content":{"rendered":"<h2>Method 1 &#8211; Remi Repo<\/h2>\n<p>The Remi Repository (famillecollet.com) maintains the newest PHP for CentOS, RHEL, etc. And by newest, I mean newer than all other major repos.<\/p>\n<p>All you need to do is install PHP with Remi enabled. As of writing this article, Remi has 5.4.23 for CentOS, RHEL, etc. If you want even newer version or any other custom version, see method #2.<\/p>\n<pre lang=\"sh\" line=\"1\" escaped=\"true\">yum install php<\/pre>\n<p>If you are also looking for how to install remi on your system, <a href=\"http:\/\/www.rackspace.com\/knowledge_center\/article\/installing-rhel-epel-repo-on-centos-5x-or-6x\" target=\"_blank\">check out this guide from rackspace<\/a>.<\/p>\n<p>If you are using Remi, I suggest you use yum-versionlock plugin to ensure that you stay in the right version.<\/p>\n<h2>Method 2 &#8211; Compile your own PHP<\/h2>\n<h3>Download<\/h3>\n<p>You can <a href=\"http:\/\/www.php.net\/downloads.php\" target=\"_blank\">download<\/a>\u00a0the version you want from PHP directly. As of writing the latest stable available is 5.5.7.<\/p>\n<h3>Dev Tools<\/h3>\n<p>If you don&#8217;t already have this, you can download necessary development tools via group install.<\/p>\n<pre lang=\"sh\" line=\"1\" escaped=\"true\">yum groupinstall \"Development Tools\"<\/pre>\n<h3>Required Libraries<\/h3>\n<p>You&#8217;ll also need bunch of libraries to compile PHP. The following is a mere <strong>sample<\/strong> list. You may need to adjust depending on additional modules you are installing.<\/p>\n<pre lang=\"sh\" line=\"2\" escaped=\"true\">yum install libxml2-devel httpd-devel libXpm-devel gmp-devel libicu-devel \\\r\n    t1lib-devel aspell-devel openssl-devel bzip2-devel libcurl-devel \\\r\n    libjpeg-devel libvpx-devel libpng-devel freetype-devel readline-devel \\\r\n    libtidy-devel libxslt-devel<\/pre>\n<p>Another common library often used is mcrypt (libmcrypt-devel), but that&#8217;s available under rpmforge and not the base.<\/p>\n<h3>Compiling<\/h3>\n<p>Once all the requirements are set, actual compilation is fairly simple.<\/p>\n<p>Extract the php you downloaded earlier and enter directory.<\/p>\n<pre lang=\"sh\" line=\"6\" escaped=\"true\">tar jxf php-5.4.*.tar.bz2\r\ncd php-5.4.23<\/pre>\n<p>Configure the PHP with stuff you want enabled.<\/p>\n<pre lang=\"sh\" line=\"8\" escaped=\"true\">.\/configure --enable-zip --[etc. This list can get pretty long...]<\/pre>\n<p>You can see a full list of <a href=\"http:\/\/php.net\/manual\/en\/configure.about.php\" target=\"_blank\">PHP configuration options here<\/a>.<\/p>\n<p>Then finalize with build.<\/p>\n<pre lang=\"sh\" line=\"9\" escaped=\"true\">make \r\nmake install<\/pre>\n<p>Now you have php 5.4.* on your Centos 6 \/ RHEL<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Method 1 &#8211; Remi Repo The Remi Repository (famillecollet.com) maintains the newest PHP for CentOS, RHEL, etc. And by newest, I mean newer than all other major repos. All you need to do is install PHP with Remi enabled. As of writing this article, Remi has 5.4.23 for CentOS, RHEL, etc. If you want even [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_vp_format_video_url":"","_vp_image_focal_point":[],"footnotes":""},"categories":[15],"tags":[20,6,19,10],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-centos","tag-centos-6","tag-linux","tag-php"],"_links":{"self":[{"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":8,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":157,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions\/157"}],"wp:attachment":[{"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}