0

So today I tried to run my old php website and it didn't work but I knew I installed php so I tried installing it again but couldn't.

It gave me this error:

hyperx@Hyperx:~$ sudo apt-get install php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5' has no installation candidate
hyperx@Hyperx:~$

Nor is mysql running. How could I fix that or install it?

Eliah Kagan
  • 117,780
  • Try searching with sudo apt-cache search php. – Thomas Jan 29 '17 at 16:49
  • Which Ubuntu version are you using? The current long term support version (16.04 LTS) doesn't come with PHP 5 anymore, but with PHP 7. Because of that, the package isn't named php5, but php7.0. The names of other PHP-related packages have changed by the same principle, for example php5-mysql is now php7.0-mysql. Also be aware that there have been some changes from PHP 5 to PHP 7. The most promiment would probably be the removal of the old mysql_ functions like mysql_connect or mysql_query. If your old website uses those, it probably won't work with PHP 7. – Henning Kockerbeck Jan 29 '17 at 16:54
  • Yes i was able to install it but website seems still not to be working. – ThisIsEcho Jan 29 '17 at 17:27
  • Just any kind of php document is not working just like php was not installed but it is. – ThisIsEcho Jan 29 '17 at 17:42
  • You probably need to integrate PHP to your webserver (Apache, NGINX etc.). Just because PHP is installed on your server doesn't mean that the webserver knows about it and how to use it ;) There's a high level overview for integrating PHP to Apache. With other webservers like NGINX you'd mostly use some variant of cgi like fcgi, php-fpm or scgi. Which integration method works best for you depends on the details of your server setup, what you want to do with it, who can access it (security) and so on. – Henning Kockerbeck Jan 29 '17 at 18:40

1 Answers1

1
apt-get -y install php

It's a virtual package that depends on the latest default version of PHP ...