{"id":896,"date":"2013-10-31T19:56:47","date_gmt":"2013-10-31T19:56:47","guid":{"rendered":"http:\/\/www.plugged.in\/?p=896"},"modified":"2013-10-31T19:56:47","modified_gmt":"2013-10-31T19:56:47","slug":"compiling-apache-mysql-php-source","status":"publish","type":"post","link":"https:\/\/www.veriteknik.net.tr\/en\/compiling-apache-mysql-php-source\/","title":{"rendered":"Compile and build Apache + MySQL + PHP from the source"},"content":{"rendered":"<p>This is a complete working solution to build Apache (httpd-2.2.25), MySQL (MySQL-5.6.14) and PHP (PHP-5.5.5) from the sources. Article tested many times on CentOS 6.4 and you can directly copy &amp; paste the commands below to build the lastest releases. We advise you to use a freshly installed OS as compiling may corrupt or delete your existing structure or data. The solution both tested on a clean dedicated server and a KVM virtualized VPS.<\/p>\n<p>Before you begin your compilation you should need additional header files and libraries required, please use the following code to install pre-requisities, don&#8217;t delete them as you would definitely need them when you upgrade to new releases also:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">yum install make gcc automake zlib-devel bison cmake libtool wget gcc-c++ unzip ncurses-devel openssl-devel pcre-devel libxml2-devel curl-devel gd-devel libxslt-devel<\/pre>\n<h2>Building &amp; Installing Apache prefork<\/h2>\n<p>download the latest release of Apache Web Server and unpack:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">wget http:\/\/ftp.itu.edu.tr\/Mirror\/Apache\/\/httpd\/httpd-2.2.25.tar.gz\ntar zxvf httpd-2.2.25.tar.gz \ncd httpd-2.2.25<\/pre>\n<p>We advise you to configure with the options below as this form is widely used:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">.\/configure \\\n        \"--prefix=\/etc\/httpd\" \\\n        \"--exec-prefix=\/etc\/httpd\" \\\n        \"--bindir=\/usr\/bin\" \\\n        \"--sbindir=\/usr\/sbin\" \\\n        \"--sysconfdir=\/etc\/httpd\/conf\" \\\n        \"--enable-so\" \\\n        \"--enable-dav\" \\\n        \"--enable-dav-fs\" \\\n        \"--enable-dav-lock\" \\\n        \"--enable-suexec\" \\\n        \"--enable-deflate\" \\\n        \"--enable-unique-id\" \\\n        \"--enable-mods-static=most\" \\\n        \"--enable-reqtimeout\" \\\n        \"--with-mpm=prefork\" \\\n        \"--with-suexec-caller=apache\" \\\n        \"--with-suexec-docroot=\/\" \\\n        \"--with-suexec-gidmin=100\" \\\n        \"--with-suexec-logfile=\/var\/log\/httpd\/suexec_log\" \\\n        \"--with-suexec-uidmin=100\" \\\n        \"--with-suexec-userdir=public_html\" \\\n        \"--with-suexec-bin=\/usr\/sbin\/suexec\" \\\n        \"--with-included-apr\" \\\n        \"--with-pcre=\/usr\" \\\n        \"--includedir=\/usr\/include\/apache\" \\\n        \"--libexecdir=\/usr\/lib\/apache\" \\\n        \"--datadir=\/var\/www\" \\\n        \"--localstatedir=\/var\" \\\n        \"--enable-logio\" \\\n        \"--enable-ssl\" \\\n        \"--enable-rewrite\" \\\n        \"--enable-proxy\" \\\n        \"--enable-expires\" \\\n        \"--with-ssl=\/usr\" \\\n        \"--enable-headers\"<\/pre>\n<p>to build and install source distro, type:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">make\nmake install<\/pre>\n<h2>Build &amp; Install MySQL<\/h2>\n<p>Since we need headers and libraries of mysql for compiling PHP, we will first install MySQL server before PHP compilation.<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">wget http:\/\/dev.mysql.com\/get\/Downloads\/MySQL-5.6\/mysql-5.6.14.tar.gz\/from\/http:\/\/cdn.mysql.com\/\ntar zxvf mysql-5.6.14.tar.gz \ncd mysql-5.6.14\ngroupadd mysql\nuseradd -g mysql mysql\ncmake .  -DMYSQL_UNIX_ADDR=\/var\/lib\/mysql\/mysql.sock\nmake\nmake install<\/pre>\n<p>If you encounter problems while running cmake, you have to delete <strong>CmakeCache.txt<\/strong> before re-compiling with cmake<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">#log in to newly created mysql dir\ncd \/usr\/local\/mysql\/\n#change owner and group\nchown -R mysql:mysql .\nscripts\/mysql_install_db --user=mysql --datadir=\/var\/lib\/mysql\n#add service command\ncp support-files\/mysql.server \/etc\/init.d\/mysqld\nchkconfig --add mysqld\nchkconfig mysqld on\n#start mysql server\nservice mysqld start<\/pre>\n<p>change your mysql password by typing:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">.\/bin\/mysqladmin -u root password 'new-password' \n.\/bin\/mysqladmin -u root -h change.this.hostname password 'new-password'<\/pre>\n<h2>Build libmcrypt from the source<\/h2>\n<p>libmcypt repo is not included in the main yum repo, so better install it from the source:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">wget http:\/\/sourceforge.net\/projects\/mcrypt\/files\/Libmcrypt\/2.5.8\/libmcrypt-2.5.8.tar.gz\/download?use_mirror=garr\ntar zxvf libmcrypt-2.5.8.tar.gz\ncd libmcrypt-2.5.8\n.\/configure\nmake\nmake install<\/pre>\n<h2>Building PHP-5.5.5 from the source<\/h2>\n<p>PHP configuration is also given with the mostly used modules &amp; functionality, download unpack &amp; configure as stated below:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">wget http:\/\/us2.php.net\/get\/php-5.5.5.tar.gz\/from\/this\/mirror\ntar zxvf php-5.5.5.tar.gz\ncd php-5.5.5\n.\/configure \\\n        --with-apxs2 \\\n        --with-curl=\/usr \\\n        --with-gd \\\n        --with-gettext \\\n        --with-jpeg-dir=\/usr \\\n        --with-freetype-dir=\/usr \\\n        --with-kerberos \\\n        --with-openssl \\\n        --with-mcrypt=\/usr\/local\/lib \\\n        --with-mhash \\\n        --with-mysql=mysqlnd \\\n        --with-mysqli=mysqlnd \\\n        --with-pcre-regex \\\n        --with-pear \\\n        --with-png-dir=\/usr \\\n        --with-xsl \\\n        --with-zlib \\\n        --with-zlib-dir=\/usr \\\n        --with-iconv \\\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\nmake\nmake install\nlibtool --finish \/root\/php-5.5.5\/libs\ncp php.ini-production \/usr\/local\/lib\/php.ini\nsed -i 's\/;date.timezone =.*\/  date.timezone \\= \"Europe\\\/Istanbul\"\/' \/usr\/local\/lib\/php.ini<\/pre>\n<h3>Download phpMyAdmin and install it to webroot:<\/h3>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">wget http:\/\/downloads.sourceforge.net\/project\/phpmyadmin\/phpMyAdmin\/4.0.8\/phpMyAdmin-4.0.8-all-languages.tar.gz\ntar zxvf phpMyAdmin-4.0.8-all-languages.tar.gz \nmv phpMyAdmin-4.0.8-all-languages \/var\/www\/\nmv \/var\/www\/phpMyAdmin-4.0.8-all-languages\/ \/var\/www\/phpMyAdmin<\/pre>\n<p>create a test page to see if everything went well:<\/p>\n<pre class=\"brush: shell; gutter: true; first-line: 1\">echo \"&lt;?PHP phpInfo();?&gt;\" &gt; \/var\/www\/index.php<\/pre>\n<p>If you cannot see a PHP info page, you need to add httpd directives to your 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\/extra\/httpd-php.conf\necho \"AddType application\/x-httpd-php-source .phps\" &gt;&gt; \/etc\/httpd\/conf\/extra\/httpd-php.conf\n\necho \"Include conf\/extra\/httpd-php.conf\" &gt;&gt; \/etc\/httpd\/conf\/httpd.conf<\/pre>\n<p>restart apache by typing: <strong>apachectl restart<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a complete working solution to build Apache (httpd-2.2.25), MySQL (MySQL-5.6.14) and PHP (PHP-5.5.5) from the sources. Article tested many times on CentOS 6.4 and you can directly copy &amp; paste the commands below to build the lastest releases. We advise you to use a freshly installed OS as compiling may corrupt or delete [&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":[367,370,413,364,416],"tags":[365,532,366,575,576,577,392,578,373,579,375,567,380,580,581],"yst_prominent_words":[2034,1133,1974,155,1446,1448,1870,937,897,2029,2035,665,936,2031,2033,337,2030,2002,2032,2036],"class_list":["post-896","post","type-post","status-publish","format-standard","hentry","category-httpd","category-linux","category-linux-optimization","category-mysql-databases","category-php-programming","tag-apache","tag-build","tag-centos","tag-centos6","tag-centos6-4","tag-compile","tag-httpd","tag-httpd-2-2-25","tag-mysql","tag-mysql-5-6-14","tag-php","tag-php-5-5-5","tag-phpmyadmin","tag-source","tag-stratch"],"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":"This is a complete working solution to build Apache (httpd-2.2.25), MySQL (MySQL-5.6.14) and PHP (PHP-5.5.5) from the sources. Article tested many times on CentOS 6.4 and you can directly copy &amp; paste the commands below to build the lastest releases. We advise you to use a freshly installed OS as compiling may corrupt or delete&hellip;","_links":{"self":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/896","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=896"}],"version-history":[{"count":1,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/896\/revisions"}],"predecessor-version":[{"id":7469,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/896\/revisions\/7469"}],"wp:attachment":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/media?parent=896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/categories?post=896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/tags?post=896"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/yst_prominent_words?post=896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}