{"id":13,"date":"2006-08-06T15:31:00","date_gmt":"2006-08-06T19:31:00","guid":{"rendered":"http:\/\/www.benh.org\/techie\/2006\/08\/installing-apache-php-mysql-on-windows-machine\/"},"modified":"2007-02-27T21:59:01","modified_gmt":"2007-02-28T02:59:01","slug":"installing-apache-php-mysql-on-windows-machine","status":"publish","type":"post","link":"https:\/\/www.benh.org\/techblog\/2006\/08\/installing-apache-php-mysql-on-windows-machine\/","title":{"rendered":"Installing Apache \/ PHP \/ MySQL on Windows machine"},"content":{"rendered":"<div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" ><\/div><p><strong>Tutorial for hassle free Apache \/ PHP \/ MySQL installation.<\/strong><br \/>\n<!--adsense#ads--><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Hello, I decided to write this post since I knew few people who are not be able to getaway with the installation since they are too new to this world!<\/span><\/span><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">So to make their\/your installation trouble free i&#8217;d to write this guide \ud83d\ude42<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">This method works well with all Windows PC. Hope this helps people.!<\/span><\/span><\/p>\n<p><span style=\"font-weight: bold; font-size: 100%\"><span style=\"font-family: trebuchet ms\">Install Apache<\/span><\/span><span style=\"font-size: 100%\"><br \/>\n<\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Apache is most trusted web server that suits for the installation of PHP on your machine. Apache is an open source web server, which has captured almost 80% of web server market today.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Download latest version of apache windows binary installation from <a href=\"http:\/\/httpd.apache.org\/download.cgi\">http:\/\/httpd.apache.org\/download.cgi<\/a>. The latest version that is available today is Win32 Binary (MSI Installer): <a href=\"http:\/\/www.uniontransit.com\/apache\/httpd\/binaries\/win32\/apache_2.2.3-win32-x86-no_ssl.msi\">apache_2.2.3-win32-x86-no_ssl.msi<\/a> <\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Before installing make sure to disable IIS web server if running. Since it might conflict with the default HTTP port 80, in which apache runs by default.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now let us install Apache web server into your PC. Execute the previously downloaded apache installation file which is standard Windows installation file and thus very straightforward. Just fill in the required information on screen and end the installation.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Once you have done your apache installation try visiting http:\/\/localhost; you should get an apache test page. If you\u00e2\u20ac\u2122re done with successful test page, you\u00e2\u20ac\u2122re ready to proceed to next step.<\/span><\/span><\/p>\n<p><span style=\"font-weight: bold; font-size: 100%\"><span style=\"font-family: trebuchet ms\">Install PHP<\/span><br \/>\n<\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Congrats! You\u00e2\u20ac\u2122ve made a wise decision to install PHP, a leading open source web programming language.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now visit <a href=\"http:\/\/www.php.net\/downloads.php\">http:\/\/www.php.net\/downloads.php<\/a> to download latest version of PHP. Download the latest available windows binary version in ZIP format.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Once download is complete; unzip the package into a directory preferably in root drive say C:\\PHP. Now you\u00e2\u20ac\u2122ve to move the file named \u00e2\u20ac\u0153phpXts.dll\u00e2\u20ac\u009d from the PHP installation directory to Windows directory (C:\\Windows or C:\\winnt depending upon your OS version); X stands for the version of PHP being installed. Make an entry to C:\\PHP in the PATH environment variable.<\/span><\/span><\/p>\n<p><span style=\"font-weight: bold; font-size: 85%\"><span style=\"font-family: trebuchet ms\">Configuring PHP<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now you need to tell apache web server what to do when it encounters PHP file. To make this work we need to make some modification in both apache and PHP configuration files.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Before doing any modification to configuration files, create a directory where you\u00e2\u20ac\u2122re going to place the web application. Say C:\\www<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">First rename the php.ini-dist to php.ini in PHP installation directory, in our case C:\\PHP. Then modify the following in php.ini <\/span><\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">        doc_root = \u00e2\u20ac\u0153c:\\www\u00e2\u20ac\u009d<\/span><\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">        extension_dir = &#8220;C:\\php\\ext<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Change the location if you\u00e2\u20ac\u2122ve installed in different location.<\/span><\/span><\/p>\n<p><span style=\"font-style: italic; font-size: 85%\"><span style=\"font-family: trebuchet ms\">Note:  Use backslashes while you specify any path in configuration files.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now open httpd.conf file available in apache configuration directory  (generally C:\\Program Files\\Apache Group\\Apache2\\conf\\). Edit the DocumentRoot entry to DocumentRoot &#8220;C:\/www&#8221;<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Then change the Directory Entry as <directory>. Add the following entry into the configuration file as well before AddHandler section (do a search for \u00e2\u20ac\u0153AddHandler\u00e2\u20ac\u009d for find the position fast).<\/directory><\/span><\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">    <\/span><\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">    ScriptAlias \/php\/ &#8220;c:\/php\/&#8221;<\/span><\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">    AddType application\/x-httpd-php .php .php5<\/span><\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">    Action application\/x-httpd-php &#8220;\/php\/php-cgi.exe&#8221;   # if PHP5<\/span><\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">    Action application\/x-httpd-php &#8220;\/php\/php.exe&#8221;       # if PHP4<\/span><\/span><br \/>\n<span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">    SetEnv PHPRC &#8220;C:\/php&#8221;<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Finally add index.php to the DirectoryIndex entry as well like \u00e2\u20ac\u0153DirectoryIndex index.html index.html.var index.php\u00e2\u20ac\u009d<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now you\u00e2\u20ac\u2122re ready before testing the PHP; you need to restart Apache web server to effect the changes. <\/span><\/span><\/p>\n<p><span style=\"font-weight: bold; font-size: 85%\"><span style=\"font-family: trebuchet ms\">Testing PHP<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Create a file named phpinfo.php in C:\\www or whether you configured as home directory. In phpinfo.php add \u00e2\u20ac\u0153  and save.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now point your browser to http:\/\/localhost\/phpinfo.php and you should be able to see the PHP environmental variables displayed. If you\u00e2\u20ac\u2122ve not seen that page you need to review the installation process again, you might have missed or went wrong in any of the above steps \ud83d\ude42 <\/span><\/span><\/p>\n<p><span style=\"font-weight: bold; font-size: 100%\"><span style=\"font-family: trebuchet ms\">Install MySQL<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now we\u00e2\u20ac\u2122re almost in the final stage, we need to prepare a backend so that our web applications can make use of it. MySQL is the best choice to combine with apache and php.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Download the latest version of MySQL from <a href=\"http:\/\/dev.mysql.com\/downloads.\">http:\/\/dev.mysql.com\/downloads<\/a>. You\u00e2\u20ac\u2122ve to download the latest available stable Window MySQL into your PC. <\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Once download is complete, double click on the MSI installation file, which you have just downloaded. Follow the onscreen instruction to complete the installation. Skip the sign up section and make sure you check \u00e2\u20ac\u0153configure the MySQL Server now\u00e2\u20ac\u009d option.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now you will get a configuration dialog box, which can be configured easily by reading the instruction. Make sure  \u00e2\u20ac\u0153Install As Windows Service\u00e2\u20ac\u009d is checked in the configuration page. Then define your admin password as well.<\/span><\/span><\/p>\n<p><span style=\"font-weight: bold; font-size: 85%\"><span style=\"font-family: trebuchet ms\">Setting up MySQL<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">First of all, check the c:\\php directory and make sure that the files libmysqli.dll and php_mysqli.dll are both there. If they are not there, check the c:\\php\\ext directory and copy the files into c:\\php<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Then open up the file c:\\php\\php.ini in your editor and ADD the line extension=php_mysqli.dll<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Now restart the apache web server to reflect the changes made.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">Create a php file and test the mysql functions to connect to the database. Make sure your  MySQL server running before executing the php program.<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">You can use PHPMyAdmin (www.phpmyadmin.net\/) to manage your MySQL database through easy to use web interface.<\/span><\/span><\/p>\n<p><span style=\"font-weight: bold; font-size: 85%\"><span style=\"font-family: trebuchet ms\">Learning PHP<\/span><\/span><\/p>\n<p><span style=\"font-size: 85%\"><span style=\"font-family: trebuchet ms\">The complete PHP reference manual can be obtained from the php website itself. You can start learning other basic books to start off with PHP!!!<\/span><\/span><\/p>\n<p><span style=\"font-weight: bold; font-size: 85%\"><span style=\"font-family: trebuchet ms\">Have fun with php!!<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tutorial for hassle free Apache \/ PHP \/ MySQL installation. Hello, I decided to write this post since I knew few people who are not be able to getaway with the installation since they are too new to this world!So to make their\/your installation trouble free i&#8217;d to write this guide \ud83d\ude42 This method works [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[10],"tags":[75,105,77,215,76,78,211],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-apache","tag-guide","tag-mysql","tag-open-source","tag-php","tag-wamp","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":0,"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.benh.org\/techblog\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}