Apache and PHP are two essential components required for running a web server. Here are the steps to install Apache and PHP in Ubuntu:
Update the package repository:
sqlsudo apt-get update
Install Apache:
arduinosudo apt-get install apache2
Verify that Apache is installed and running by opening a web browser and entering your server's IP address in the address bar. You should see the default Apache web page.
Install PHP and its extensions:
vbnetsudo apt-get install php libapache2-mod-php php-mysql
Here,
php
is the PHP scripting language,libapache2-mod-php
is a module that enables Apache to serve PHP content, andphp-mysql
is a PHP extension for MySQL database support.Verify that PHP is installed and working by creating a test PHP file:
csssudo nano /var/www/html/info.php
Paste the following code into the file:
php<?php phpinfo(); ?>
Save and close the file by pressing
Ctrl+X
, thenY
, and finallyEnter
.Restart Apache to apply the changes:
sudo systemctl restart apache2
Open a web browser and navigate to
http://your-server-ip/info.php
. You should see a page displaying PHP information.
That's it! You have successfully installed Apache and PHP on your Ubuntu server.
No comments:
Post a Comment