{"id":525,"date":"2012-06-01T10:31:42","date_gmt":"2012-06-01T10:31:42","guid":{"rendered":"http:\/\/www.plugged.in\/?p=525"},"modified":"2012-06-01T10:31:42","modified_gmt":"2012-06-01T10:31:42","slug":"building-php-5-4-3-on-centos","status":"publish","type":"post","link":"https:\/\/www.veriteknik.net.tr\/en\/building-php-5-4-3-on-centos\/","title":{"rendered":"Building PHP 5.4.3 on CentOS"},"content":{"rendered":"<p>Even though it&#8217;s easier to use yum, sometimes we need to compile PHP from source code. Below I&#8217;ll describe a method for compiling PHP 5.4.3 on CentOS, this works both on 5.x and 6.x and all the dependencies (except for PHP itself, of course ) will be retrieved via yum.<\/p>\n<p>After a fresh install of CentOS, we will need the wget binary, if you don&#8217;t already have it, get it with yum.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">yum install wget -y<\/pre>\n<p>For some of the dependencies to get installed, we&#8217;ll need the rpmforge repository, so let&#8217;s add it.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">wget http:\/\/packages.sw.be\/rpmforge-release\/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm\nrpm --import http:\/\/apt.sw.be\/RPM-GPG-KEY.dag.txt\nrpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm\nrpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm<\/pre>\n<p>Now let&#8217;s install the dependencies for our PHP compilation. Keep in mind that these are only for the configuration I&#8217;ll describe below, if you use a different compilation, you&#8217;ll need to get different packages. Also keep in mind that here I&#8217;ll only download the x86_64 packages, if you&#8217;re using a different architecture, just delete the x86_64 on every package name that contains it. The reason I specifically used that notation is to avoid downloading i386 packages, which is unnecessary but yum insists on downloading anyway.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">yum install gcc make automake autoconf perl.x86_64 httpd-devel.x86_64 libxml2-devel.x86_64 openssl-devel.x86_64 pcre-devel.x86_64 bzip2-devel.x86_64 curl-devel.x86_64 enchant-devel.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 libXpm-devel.x86_64 freetype-devel.x86_64 gmp-devel.x86_64 libicu-devel.x86_64 gcc-c++ libmcrypt-devel.x86_64 postgresql-devel.x86_64 aspell-devel.x86_64 libedit-devel.x86_64 recode-devel.x86_64 net-snmp-devel.x86_64 libtidy-devel.x86_64 libxslt-devel.x86_64 libcurl-devel.x86_64 libtool-ltdl-devel.x86_64 -y<\/pre>\n<p>Now let&#8217;s download the php 5.4.3 source code.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">wget http:\/\/tr.php.net\/get\/php-5.4.3.tar.gz\/from\/this\/mirror\ntar xvzf php-5.4.3.tar.gz\ncd php-5.4.3<\/pre>\n<p>We can start the configure-make-make install trio now.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">.\/configure  --with-apxs2=\/usr\/sbin\/apxs --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= --prefix=\/usr --exec-prefix=\/usr --bindir=\/usr\/bin --sbindir=\/usr\/sbin --sysconfdir=\/etc --datadir=\/usr\/share --includedir=\/usr\/include --libdir=\/usr\/lib64 --libexecdir=\/usr\/libexec --localstatedir=\/var --sharedstatedir=\/var\/lib --mandir=\/usr\/share\/man --infodir=\/usr\/share\/info --cache-file=..\/config.cache --with-libdir=lib64 --with-config-file-path=\/etc --with-config-file-scan-dir=\/etc\/php.d --disable-debug --with-pic --disable-rpath --with-bz2 --with-freetype-dir=\/usr --with-png-dir=\/usr --with-xpm-dir=\/usr --enable-gd-native-ttf --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=\/usr --with-openssl --with-pcre-regex=\/usr --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --with-kerberos --enable-shmop --enable-calendar --with-libxml-dir=\/usr --enable-xml --enable-pcntl --with-imap-ssl --enable-mbregex --enable-bcmath=shared --enable-dba=shared --with-db4=\/usr --with-xmlrpc=shared --with-mysql --with-mysqli --enable-dom=shared --with-pgsql --enable-wddx=shared --with-snmp=shared,\/usr --enable-soap=shared --with-xsl=shared,\/usr --enable-xmlreader=shared --enable-xmlwriter=shared --with-curl --enable-json --enable-zip=shared --without-readline --with-libedit --with-pspell=shared --enable-phar=shared --with-tidy=shared,\/usr --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared --enable-posix=shared --enable-fileinfo=shared --enable-intl=shared --with-icu-dir=\/usr --with-enchant=shared,\/usr --with-recode=shared,\/usr --enable-mbstring --with-mcrypt --with-gd\nmake\nmake install<\/pre>\n<p>Now we have php installed.<\/p>\n<p>Further we can configure the basic steps of Apache.<br \/>\nEdit your httpd.conf file : \/etc\/httpd\/conf\/httpd.conf<br \/>\nFind the line that says <em>AddType application\/x-tar .tgz <\/em>Append these two lines below it.<\/p>\n<p><strong>AddType application\/x-httpd-php .php<\/strong><br \/>\n<strong>AddType application\/x-httpd-php-source .phps <\/strong><\/p>\n<p>Also we should tell apache that index.php is an index file (or whatever index you want), so update your <em>DirectoryIndex<\/em> as following :<\/p>\n<p><strong>DirectoryIndex index.html index.html.var index.php index.htm<\/strong><\/p>\n<p>copy\u00a0php.ini-production to \/etc\/php.ini and edit the file based on your performance requirements, please have a look at our security pages to secure your php configuration from the <a title=\"Web Hosting Security premier\" href=\"http:\/\/www.plugged.in\/linux\/web-hosting-security\/web-hosting-security-premier.html\" target=\"_blank\">link<\/a>.<\/p>\n<p>Some suggestions: Increase upload limit, raise memory_limit to 256M and set date.timezone to your location, in our case it is:<\/p>\n<p>date.timezone = Europe\/Istanbul<\/p>\n<p>After saving and exiting the httpd.conf file, restart your Apache services. ( <strong>service httpd restart<\/strong> )<\/p>\n<p>Now you have <strong>\/var\/www\/html<\/strong> as your default web home root, and PHP 5.4.3 running on it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Even though it&#8217;s easier to use yum, sometimes we need to compile PHP from source code. Below I&#8217;ll describe a method for compiling PHP 5.4.3 on CentOS, this works both on 5.x and 6.x and all the dependencies (except for PHP itself, of course ) will be retrieved via yum. After a fresh install of [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[367,370,413],"tags":[365,532,392,375],"yst_prominent_words":[],"class_list":["post-525","post","type-post","status-publish","format-standard","hentry","category-httpd","category-linux","category-linux-optimization","tag-apache","tag-build","tag-httpd","tag-php"],"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":"Mustafa Emre Ayd\u0131n","author_link":"https:\/\/www.veriteknik.net.tr\/en\/author\/eaydin\/"},"uagb_comment_info":0,"uagb_excerpt":"Even though it&#8217;s easier to use yum, sometimes we need to compile PHP from source code. Below I&#8217;ll describe a method for compiling PHP 5.4.3 on CentOS, this works both on 5.x and 6.x and all the dependencies (except for PHP itself, of course ) will be retrieved via yum. After a fresh install of&hellip;","_links":{"self":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/525","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\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/comments?post=525"}],"version-history":[{"count":0,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/525\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/media?parent=525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/categories?post=525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/tags?post=525"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/yst_prominent_words?post=525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}