{"id":1263,"date":"2009-10-08T15:57:42","date_gmt":"2009-10-08T20:57:42","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=1263"},"modified":"2012-04-17T15:44:04","modified_gmt":"2012-04-17T20:44:04","slug":"install-apache-2-and-php-5-on-rhel-4","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=1263","title":{"rendered":"Install Apache 2 and PHP 5 on RHEL 5"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Dependencies\">Dependencies<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Install_Apache_2\">Install Apache 2<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Auto_Start_Apache_2\">Auto Start Apache 2<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Install_MySql_Shared_Library\">Install MySql Shared Library<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Install_PHP_5\">Install PHP 5<\/a>\n\t<\/li>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<span id=\"Dependencies\"><h2>Dependencies<\/h2><\/span>\n<p>* Make sure following packages are installed: bison flex gcc db4 db4-devel libxml2-devel libpng-devel. Installed if not already with <\/p>\n<pre>yum install bison flex gcc db4 db4-devel libxml2-devel libpng-devel<\/pre>\n<span id=\"Install_Apache_2\"><h2>Install Apache 2<\/h2><\/span>\n<pre lang=\"bash\">\r\nwget http:\/\/www.gossipcheck.com\/mirrors\/apache\/httpd\/httpd-2.2.14.tar.gz\r\n\r\ntar xvxf httpd-2.2.14.tar.gz\r\n\r\ncd httpd-2.2.14\r\n\r\n.\/configure \\\r\n  --enable-so \\\r\n  --enable-rewrite=shared \\\r\n  --enable-headers \\\r\n  --enable-proxy \\\r\n  --enable-proxy-balancer \\\r\n  --enable-proxy-connect \\\r\n  --enable-proxy-http \\\r\n  --enable-rewrite \\\r\n  --enable-ssl\r\n\r\nmake\r\nmake install\r\n\r\n# Start\/Stop\r\n\/usr\/local\/apache2\/bin\/apachectl start\r\n\/usr\/local\/apache2\/bin\/apachectl stop\r\n<\/pre>\n<span id=\"Auto_Start_Apache_2\"><h3>Auto Start Apache 2<\/h3><\/span>\n<p>* cp \/usr\/local\/apache2\/bin\/apachectl \/etc\/init.d<br \/>\n* chmod 755 \/etc\/init.d\/apachectl<\/p>\n<p>* Add to \/etc\/init.d\/apachectl right below #!\/bin\/sh with comments on<\/p>\n<pre lang=\"bash\">\r\n#\r\n# Startup script for the Apache Web Server\r\n#\r\n# chkconfig: - 85 15\r\n# description: Apache is a World Wide Web server. It is used to serve\r\n# HTML files and CGI.\r\n# processname: httpd\r\n# pidfile: \/usr\/local\/apache\/logs\/httpd.pid\r\n# config: \/usr\/local\/apache\/conf\/httpd.conf\r\n#\r\n<\/pre>\n<p>* \/sbin\/chkconfig &#8211;add apachectl<br \/>\n* \/sbin\/chkconfig &#8211;level 35 apachectl on<\/p>\n<span id=\"Install_MySql_Shared_Library\"><h2>Install MySql Shared Library<\/h2><\/span>\n<p>* Required for PHP &#8211;with-mysql configure option<\/p>\n<pre lang=\"bash\">\r\n\r\n<\/pre>\n<span id=\"Install_PHP_5\"><h2>Install PHP 5<\/h2><\/span>\n<p>* Build and Compile yourself<\/p>\n<pre lang=\"bash\">\r\nwget http:\/\/us2.php.net\/get\/php-5.3.0.tar.gz\/from\/us3.php.net\/mirror\r\ntar zxvf php-5.3.0.tar.gz\r\ncd php-5.3.0\r\n\r\n.\/configure \\\r\n  --with-apxs2=\/usr\/local\/apache2\/bin\/apxs \\\r\n  --enable-bcmath \\\r\n  --with-pear \\\r\n  --enable-sockets \\\r\n  --with-zlib \\\r\n  --with-gd \\\r\n  --with-freetype\r\nmake\r\nmake install\r\n\r\ncp php.ini-dist \/usr\/local\/lib\/php.ini\r\n\r\nvi \/usr\/local\/apache2\/conf\/httpd.conf\r\n  AddHandler application\/x-httpd-php .php .phtml .php3 .php4\r\n\r\n# Not sure why we need to do this\r\nchcon -t texrel_shlib_t \/usr\/local\/apache\/modules\/libphp5.so\r\n\r\n\/usr\/local\/apache2\/bin\/apachectl start\r\n<\/pre>\n<p>* Use RPM Source Package<\/p>\n<pre lang=\"bash\">\r\nwget ftp:\/\/ftp.redhat.com\/pub\/redhat\/linux\/enterprise\/5Server\/en\/os\/SRPMS\/php-5.1.6-23.2.el5_3.src.rpm\r\nrpm --rebuild php-5.1.6-23.2.el5_3.src.rpm\r\ncd \/usr\/src\/redhat\/RPM\/\r\nrpm -iv php-5.1.6-23.2.el5_3.rpm \r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Dependencies * Make sure following packages are installed: bison flex gcc db4 db4-devel libxml2-devel libpng-devel. Installed if not already with yum install bison flex gcc db4 db4-devel libxml2-devel libpng-devel Install Apache 2 wget http:\/\/www.gossipcheck.com\/mirrors\/apache\/httpd\/httpd-2.2.14.tar.gz tar xvxf httpd-2.2.14.tar.gz cd httpd-2.2.14 .\/configure &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=1263\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[21,61],"tags":[],"class_list":["post-1263","post","type-post","status-publish","format-standard","hentry","category-apache","category-linux"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-kn","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1263"}],"version-history":[{"count":7,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions"}],"predecessor-version":[{"id":1265,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions\/1265"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}