{"id":1011,"date":"2015-08-31T23:53:03","date_gmt":"2015-08-31T23:53:03","guid":{"rendered":"http:\/\/www.plugged.in\/?p=1011"},"modified":"2015-08-31T23:53:03","modified_gmt":"2015-08-31T23:53:03","slug":"php-5-4-44-on-centos-6-7","status":"publish","type":"post","link":"https:\/\/www.veriteknik.net.tr\/en\/php-5-4-44-on-centos-6-7\/","title":{"rendered":"PHP 5.4.44 on CentOS 6.7"},"content":{"rendered":"<p>Most of the yum repos doesn&#8217;t include PHP5.4.X on current releases for the time being. So if you need PHP5.4.X, you need to compile and build it for your self. I decided to put all required packages to the compilation, so most probably you wouldn&#8217;t need additional packages, just a quick tip, if you need additional packages you can install via pecl or pear tools.<\/p>\n<h3>Which PHP configure options should I use before compiling?<\/h3>\n<p>If you ever need to get the list of modules installed in your current PHP, type the following command via console:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">php -m<\/pre>\n<p>So, take a list of your current configuration and check the configure list below in order to have a compatible compilation to your existing older version of PHP.<\/p>\n<p>Advise: First of all, you should consider removing php packages from your server before compiling php, but beaware your codes will be visible till you install the compiled version to your server, consider shutting down your apache server for a while.<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">yum erase php*<\/pre>\n<p>Before downloading the code, install &#8220;Development Tools&#8221; by tiping:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">yum groupinstall \"Development Tools\"<\/pre>\n<p>and install other related header files:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">yum install httpd-devel libtool-ltdl-devel libxml2-devel bzip2-devel net-snmp-devel openssl-devel pcre-devel curl-devel gd-devel mysql-devel libxslt-devel postgresql-devel gmp-devel<\/pre>\n<p>Download &amp; install libmcrypt<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">cd \/usr\/src\nwget http:\/\/downloads.sourceforge.net\/project\/mcrypt\/Libmcrypt\/2.5.8\/libmcrypt-2.5.8.tar.gz\n   tar zxvf libmcrypt-2.5.8.tar.gz \n   cd libmcrypt-2.5.8\n   .\/configure -libdir=\/usr\/lib64\n   make\n   make install<\/pre>\n<p>&nbsp;<\/p>\n<p>Download &amp; extract php 5.4.44 release:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">wget http:\/\/php.net\/get\/php-5.4.44.tar.gz\/from\/this\/mirror\nmv mirror php-5.4.44.tar.gz\ntar zxvf php-5.4.44.tar.gz\n.\/configure \\\n --with-apxs2 \\\n --with-curl=\/usr\/local\/lib \\\n --with-config-file-path=\/etc \\\n --with-config-file-scan-dir=\/etc\/php.d \\\n --with-pic \\\n --with-gd \\\n --with-gettext \\\n --with-jpeg-dir=\/usr\/local\/lib \\\n --with-freetype-dir=\/usr\/local\/lib \\\n --enable-sockets \\\n --with-kerberos \\\n --with-openssl \\\n --with-mhash \\\n --with-mcrypt=\/usr\/local\/lib \\\n --with-mysql=\/usr \\\n --with-mysqli=\/usr\/bin\/mysql_config \\\n --with-pdo-mysql=\/usr \\\n --with-pdo-pgsql=\/usr \\\n --with-pcre-regex=\/usr \\\n --with-pear \\\n --with-gmp \\\n --with-pgsql \\\n --with-png-dir=\/usr\/local\/lib \\\n --with-xsl \\\n --with-zlib \\\n --with-zlib-dir=\/usr\/local\/lib \\\n --with-iconv \\\n --with-libxml-dir=\/usr \\\n --enable-bcmath \\\n --enable-calendar \\\n --enable-exif \\\n --enable-ftp \\\n --enable-gd-native-ttf \\\n --enable-soap \\\n --enable-sockets \\\n --enable-mbstring \\\n --enable-zip \\\n --enable-wddx \\\n --enable-shmop \\\n --with-libdir=lib64 \\\n --disable-debug \\\n --with-bz2 \\\n --enable-gd-native-ttf \\\n --enable-xml \\\n --with-snmp=\/usr \\\n --enable-json \n<\/pre>\n<p>Make &amp; Install by typing:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">make\nmake install\ncp php.ini-production \/etc\/php.ini\n<\/pre>\n<p>Get rid of obsolete settings:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">sed -i 's#;date.timezone =.*# \u00a0date.timezone = \"Europe\/Istanbul\"#' \/etc\/php.ini\nsed -i 's#upload_max_filesize =.*#upload_max_filesize = 200M#' \/etc\/php.ini\nsed -i 's#post_max_size =.*#post_max_size = 200M#' \/etc\/php.ini\n<\/pre>\n<p>Don&#8217;t forget to add respective extension to httpd.conf:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">echo \"AddType application\/x-httpd-php .php\" &gt;&gt; \/etc\/httpd\/conf.d\/php.conf\necho \"AddType application\/x-httpd-php-source .phps\" &gt;&gt; \/etc\/httpd\/conf.d\/php.conf<\/pre>\n<p>and a final configuration:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">sed -i 's\/DirectoryIndex index.html.*\/  DirectoryIndex index.html index.html.var index.php\/' \/etc\/httpd\/conf\/httpd.conf<\/pre>\n<p>please let us know if you find any mistake<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most of the yum repos doesn&#8217;t include PHP5.4.X on current releases for the time being. So if you need PHP5.4.X, you need to compile and build it for your self. I decided to put all required packages to the compilation, so most probably you wouldn&#8217;t need additional packages, just a quick tip, if you need [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[370,416],"tags":[366,414,415,375,417,418],"yst_prominent_words":[858,1443,1446,1448,1449,1447,939,937,897,643,1444,936,1445,337,1142,1246],"class_list":["post-1011","post","type-post","status-publish","format-standard","hentry","category-linux","category-php-programming","tag-centos","tag-freetds","tag-mssql","tag-php","tag-php-5-6","tag-php-5-6-3"],"jetpack_featured_media_url":"","uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"ckaraca","author_link":"https:\/\/www.veriteknik.net.tr\/en\/author\/ckaraca\/"},"uagb_comment_info":0,"uagb_excerpt":"Most of the yum repos doesn&#8217;t include PHP5.4.X on current releases for the time being. So if you need PHP5.4.X, you need to compile and build it for your self. I decided to put all required packages to the compilation, so most probably you wouldn&#8217;t need additional packages, just a quick tip, if you need&hellip;","_links":{"self":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/1011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/comments?post=1011"}],"version-history":[{"count":0,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/1011\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/media?parent=1011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/categories?post=1011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/tags?post=1011"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/yst_prominent_words?post=1011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}