Create dynamic sites with PHP & MySQL - Installing PHP
(Page 5 of 16 )
We will follow a similar procedure to install PHP. Download and save the source from the PHP site to /tmp/ src:
# cd /tmp/ src/ # gunzip -dc php-x.x.xx.tar.gz | tar xv # cd php-x.x.xx # ./configure --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs # make # make install |
Copy the ini file to the proper directory:
# cp php.ini-dist /usr/local/lib/php.ini |
Open httpd. conf in your text editor (probably located in /usr/local/apache/conf directory), and find a section that looks like the following:
# And for PHP 4. x, use: # #AddType application/x-httpd-php .php #AddType application/x-httpd-php-source .phps |
Just remove those #s before the AddType line so that it looks like:
# And for PHP 4. x, use: # AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps |
Save your file and restart apache:
# /usr/local/apache/bin/apachectl stop # /usr/local/apache/bin/apachectl start |
Then test whether you have PHP installed properly. Type the following code in a text editor and save it as test. php in a directory accessible by your Web server:
<HTML> <?php phpinfo(); ?> </HTML> |
Set the permission of the file to executable by typing at console chmod 775 test. php, and then view it with your browser. You should see a detailed description of the environment variables in PHP similar to the image below. If you don't, then PHP was not installed properly. Try reinstalling it. Make sure there is a section "MySQL" in the php info; if not, MySQL connectivity will not work.
Next: Your first script >>
More Database Articles Articles
More By Codewalkers
|
| · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | | |
|