{"id":6,"date":"2006-11-26T22:16:00","date_gmt":"2006-11-27T05:16:00","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=6"},"modified":"2006-11-26T22:16:00","modified_gmt":"2006-11-27T05:16:00","slug":"installing-apache-20-with-php-5-in-windows","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2006\/11\/26\/installing-apache-20-with-php-5-in-windows\/","title":{"rendered":"Installing Apache 2.0.* with PHP 5.* in Windows"},"content":{"rendered":"<p>Much documented as the above process is, a lot of people still get stuck in some part of the installation process or the other (me included). It is not a complicated process really, its just that there are some simple tips and tricks which people have learned the hard way and these tips and tricks are often not available to the newbie installer.<\/p>\n<p>Apache and PHP are softwares which are actually meant for *nix environments but a surprisingly large number of Windows developers use these platforms as a basis of all web development. Given below are the steps to get a successfull installation of Apache and PHP on Windows.<\/p>\n<p>Why Apache 2.0 and not the latest Apache 2.2.3? Because as of this date, Apache 2.0 has some dll inconsistencies with PHP 5.x versions. <a href=\"http:\/\/www.php.net\">PHP 5.2.0<\/a> has been released but I havent tried installing it with the latest <a href=\"http:\/\/www.apache.org\">Apache<\/a>. Hopefully the problems of incompatibilities have been solved this time round.<\/p>\n<p><span style=\"font-weight: bold\">1.Installing Apache 2.0<\/span><\/p>\n<ol>\n<li>Download the msi installer version of Apache 2.0. Its simpler to install from that than the zip installer<\/li>\n<li>For Windows machines which are running PWS or IIS, you need to turn off the WWW service before running the installer, because Apache defaults to using port 80 for HTTP and it wont start if it finds that port 80 is already in use.<\/li>\n<li>Run the msi installer<\/li>\n<li>Installing the Apache webserver is very simple. Simply follow the default installation screens and you are done.<\/li>\n<li>If all went well, then you will see the red Apache icon in your taskbar.<\/li>\n<li>To test if apache is running, open your web browser and type <span style=\"font-style: italic\">http:\/\/localhost<\/span> or <span style=\"font-style: italic\">http:\/\/127.0.0.1 <\/span>. You will see different pages in both the urls but it means your Apache webserver is up and running.<\/li>\n<\/ol>\n<p><span style=\"font-weight: bold\">2.Installing PHP<\/span><\/p>\n<ol>\n<li>Unzip the php zip file to a folder of your choice.<\/li>\n<li>Thats it. PHP is installed. Simple, huh? Unfortunately you cant fire up your browser and see any php files running just yet. PHP need to be linked in with Apache before php pages start to run on your machine.<\/li>\n<\/ol>\n<p><span style=\"font-weight: bold\">3.Changes to Apache 2.0 configuration<\/span><\/p>\n<ol>\n<li>Open up httpd.conf file in a text editor. This file exists in the \/conf subdirectory of the folder in which Apache is installed.<\/li>\n<li>Do a text search for &#8216;AddType&#8217;. You will find lines which start with the AddType directive. After the last AddType line add these two lines:<\/li>\n<ol>\n<li><span style=\"font-style: italic\">#php 5<\/span><\/li>\n<li><span style=\"font-style: italic\">   AddType application\/x-httpd-php .php<\/span><\/li>\n<li>This tells  Apache to handle php files as a registered application type.<\/li>\n<\/ol>\n<li>Do a text search for &#8216;DirectoryIndex&#8217;. Most likely this line will show as :<\/li>\n<li><span style=\"font-style: italic\">DirectoryIndex index.html index.html.var<\/span><\/li>\n<li>This means that if a url does not specify a file, but only a folder, then the default page to load will be index.html. We want to change it so that it loads index.php when no file is specified. So change it to :<br \/>\n<span style=\"font-style: italic\">DirectoryIndex index.php index.html index.html.var<\/span><\/li>\n<li>So now index.php becomes the default file for all directories.<\/li>\n<li>Do a text search for &#8216;LoadModule&#8217; in httpd.conf. After all the LoadModule lines add the following line (assuming php is in c:php) :<\/li>\n<ol>\n<li><span style=\"font-style: italic\"> LoadModule php5_module c:\/php\/php5apache2.dll<\/span><\/li>\n<\/ol>\n<\/ol>\n<p><strong>4.Changes to PHP configuration<\/strong><\/p>\n<ol>\n<li>Copy php.ini-dist in the php folder to php.ini. If php.ini-dist is not present, copy php.ini-recommended to php.ini.<\/li>\n<li>Open php.ini in an editor.<\/li>\n<li>Do a text search for &#8216;extension_dir&#8217; . Most likely this line will show as<\/li>\n<ol>\n<li>extension_dir = &#8220;.\/&#8221;<\/li>\n<li>Change that to the complete path where the php extensions are present. Generally this is the ext folder under the php folder. So an example of this would be :<\/li>\n<li><em>extension_dir = &#8220;c:\/php\/ext&#8221;<\/em><\/li>\n<\/ol>\n<li>Do a text search for &#8216;Windows Extensions&#8217;. Once there, scroll down till you find the lines starting with extension= . If you plan to use mysql then uncomment the line <em>extension=php_mysql.dll.<\/em><\/li>\n<li>If you want to run php with mysql then copy a file called libmysql.dll from the php directory to the Windows sytem folder i.e \/System32.<\/li>\n<li>If you want to use the curl module then asuming you have uncommented the extension=php_curl.dll in php.ini , copy ssleay32.dll and libeay32.dll from the php directory to the Windows sytem folder (System32).<\/li>\n<li>Copy the updated php.ini file into the Windows folder i.e c:windows or c:winnt.<\/li>\n<li>Copy php5ts.dll from the php directory into the Windows system folder ie.System32<\/li>\n<\/ol>\n<p><strong>5.Test php with apache<\/strong><\/p>\n<p>Make a page called test.php with the following line<em>:<\/em><\/p>\n<p><em>  phpinfo();<\/em><\/p>\n<p>and save it in the Apache default website folder ie. the htdocs folder under the Apache folder.<\/p>\n<p>Type http:\/\/localhost\/test.php<\/p>\n<p>If all has gone well, then you should see the page run.<\/p>\n<p>Let me know if I missed out on something. I would be glad to incorporate your inputs to this blog<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Much documented as the above process is, a lot of people still get stuck in some part of the installation process or the other (me <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2006\/11\/26\/installing-apache-20-with-php-5-in-windows\/\" title=\"Installing Apache 2.0.* with PHP 5.* in Windows\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[24,27,36,39,43,79,149,150,186,200,257,304,277],"class_list":["post-6","post","type-post","status-publish","format-standard","hentry","category-apachephp","tag-2-0","tag-27","tag-amit","tag-apache","tag-arunace","tag-configure","tag-install","tag-installing","tag-mysql","tag-php","tag-truelogic","tag-windows","tag-xp"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/6","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":0,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/6\/revisions"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}