Knowledgebase

Back to Tools and Features

How To Install Apache And PHP


To Install Apache And PHP, follow the instructions below:

Run the following command

yum install httpd

Now we need to start Apache, so run the following command

service httpd start

We need to install PHP, PHP-Devel so that we have some developer tools, and PHP-MySQL so that we can access MySQL through our PHP scripts.
Run the following commands

yum install php
yum install php-devel
yum install php-mysql

The PHP configuration file is called “php.ini” and is located at /etc/php.ini
Most common configuration changes:

display_errors
log_errors (if on, must specify log file name)
upload_max_filesize
post_max_filesize
memory_limit

Creating a PHP/MySQL Page
First, we need to get to our document root, for example, "cd /var/www/html/"

Run this command to get the source files:

wget http://209.236.74.122/php.zip

Now let’s unzip this file:

unzip php.zip

Now let’s make sure the file is set to connect to our database:

vi index.php

Now that we’ve verified this, let’s visit our site and see what happens. Run the following command:

vi phpinfo.php

Even though it is one line of code it is very powerful and gives you a lot of information about the current PHP install.


Related Articles

How To Create And Download A Backup
How To Delete Your Content
Does WestHost Offer Ruby On Rails Support
What Perl Modules Are Installed By Default
Does WestHost Allow TeamSpeak

Can’t Find what you need?

No worries, Our experts are here to help.