PHP is not working on ubuntu 14

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am trying to install php on my ubuntu machine. 1st I install apache2 on machine.... after that I install php7

sudo apt-get -y update
sudo add-apt-repository ppa:ondrej/php
sudo apt-get -y update
sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv

after that I restart my apache2 service apache2 restart

but still php is not working when I try to browse php page from localhost.

php -v

is also showing me output.... and telling me the php version.

in error log file of apche2 I got errors

restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu May 19 07:53:16.813504 2016] [mpm_prefork:notice] [pid 12487] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.16 configured -- resuming normal operations
[Thu May 19 07:53:16.813518 2016] [core:notice] [pid 12487] AH00094: Command line: '/usr/sbin/apache2'
[Thu May 19 08:05:24.435502 2016] [mpm_prefork:notice] [pid 12487] AH00169: caught SIGTERM, shutting down
[Thu May 19 08:05:25.513275 2016] [mpm_prefork:notice] [pid 14456] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.16 configured -- resuming normal operations
[Thu May 19 08:05:25.513343 2016] [core:notice] [pid 14456] AH00094: Command line: '/usr/sbin/apache2'
[Thu May 19 08:26:11.093404 2016] [mpm_prefork:notice] [pid 14456] AH00169: caught SIGTERM, shutting down
[Thu May 19 08:26:12.166600 2016] [mpm_prefork:notice] [pid 20497] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.16 configured -- resuming normal operations
[Thu May 19 08:26:12.166640 2016] [core:notice] [pid 20497] AH00094: Command line: '/usr/sbin/apache2'
profilepic.png
manpreet 2 years ago

If you install libapache2-mod-php7.0 in addition to libapache2-mod-php5 it will not enable itself (you should see this in {apt,dpkg}.log), so you need to disable php5 module and enable php7.0 module:

 

a2dismod php5

a2enmod php7.0

apache2ctl restart

P.S.: You should read what the packages tells you at the installation time. Running apt-get with -y is a quite sure way how to miss important stuff.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community