Install and configure PHP on ubuntu?

“Without new experiences, something inside of us sleeps. The sleeper must awaken.” Frank HerbertFrank Herbert t

Step1:- Open terminal window and type the below command(install php)

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql


We have used extra parameters for configuring php to use apache server that we already installed and also to connect with mysql. So we dont do any configurations manually 

Step2:- Verify the installation of PHP
We need to create sample php script inside the root of apache server and open it in the apache server
a) cd to apache root path, cd /var/www/html/
b) Create test.php file, sudo nano test.php
c)Add the basic phpinfo function call into file, save and exit (ctrl+x > y > enter) the nano editor
create php script inside apache root folder

d) Start apache server (sudo apachectl start) and check the test.php file(open localhost/test.php) 

launch php file in server

Step3:- Configure php settings 
a)Lets say we want to enable php logs, we need to open php.ini file 
sudo nano /etc/php/7.0/php.ini
b)Search display_errors in php.ini file and turn it to on
ctrl+w(for searching in nano)

change php.ini file
c)Restart the apache server
sudo apachectl restart
d)Check that settings are changed by checking the browser

php.ini file configured in server







ufthelp

Leave a Reply

Your email address will not be published. Required fields are marked *