- Installing Apache, PHP, MySQL on Windows Computers:
- Install the latest version of PHP for Windows using the Microsoft Web Platform Installer. It’s fast, easy and takes the guess work out of getting PHP up and running on Windows and IIS.
- Installation of Apache, PHP and MySQL is straightforward for Windows computers. Go to each of the Apache, PHP and MySQL sites to download the software. Select the appropriate ZIP file. Pick the versions that match your web server.
- Most web sites are hosted on a web server that hosts many sites. In most cases your site will be hosted with standard PHP, MySQL, Apache configurations. On your localhost (your own computer), you should not deviate too far from the configuration of your web hosting server.
- Installing Apache, PHP, MySQL for Red Hat Linux:
- Installation is similar on other Linux distributions. The first discussed is downloading and installing packages.
- First download the required packages to a directory. If you are running a different platform be sure to download the appropiate files for your platform:
- Extract the Apache and PHP package into that directory using
# tar xfz apache_1.3.14.tar.gz # tar xfz php_4.0.3pl1.tar.gz
- MySQL is easiest to install on Red Hat systems using the RPM packages. To install MySQL in the same directory as the RPM packages use the command:
# rpm -Uvh *.rpm # /etc/rc.d/init.d/mysqld start
- After MySQL is installed you need to set the root password. To do this use the following commanding changing my_password to the password you want for the root user to access MySQL.
# mysqladmin -u root password 'my_password'
- Apache with PHP can be installed a few different ways. One way is to statically embed the PHP binary into the Apache binary. Here are the step by step directions to install Apache and PHP in the directory /usr/local/apache
- In Apache src directory (apache_1.3.14/)
# ./configure --prefix=/usr/local/apache
- In PHP src directory (php-4.0.3pl1/)
# ./configure --with-mysql \ --with-xml \ --enable-track-vars \ --with-apache=../apache_1.3.14 \
# make # make install
- In Apache src directory (apache_1.3.14)
# ./configure --prefix=/usr/local/apache \ --enable-module=rewrite \ --activate-module=src/modules/php4/libphp4.a
# make # make install
- This will install Apache in the /usr/local/apache directory. The only thing left to do is to configure them.
- To configure PHP copy php.ini-dist which is in the PHP src directory to /usr/local/lib/php.ini
- To configure Apache edit /usr/local/apache/conf/httpd.conf and set the your document directory and any other Apache settings you may want. To enable Apache and PHP to work together the following line needs to be added: AddType application/x-httpd-php .php
- Look for this line or something similar already in the httpd.conf file and replace it with the above. Make sure to remove the # comment mark & then restart Apache:
# /etc/rc.d/init.d/httpd restart
- To test that Apache and PHP work together, create a PHP file. Name it index.php. The entire contents of the file are:
<?php echo("Hello World!!!"); ?>
- Copy this file to the document directory, if you did not change the document directory in the config file (httpd.conf) then the default document directory is /usr/local/apache/htdocs/ Load this page in your browser by using the following URL: http://localhost/index.php
- You should now have Apache, PHP and MySQL all installed and working nicely together.
|