4

I am new in ubuntu and I try to run a website by my own computer but I can't install php5. When i typed:

sudo apt-get install php5

I received:

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

What does it mean?

4 Answers 4

6

php5 is actually a meta-package. You should decide, whether you want to use the php5-module for apache or install the CLI/CGI-version and use that.

I'll just assume you want to go with the first option: try apt-get install libapache2-mod-php5. If that still doesn't work, check apt-cache search php5 and see if the packages are even in there, might be some mishap in your apt repository configuration.

Note: For php7, the package name is libapache2-mod-php7.0 and NOT libapache2-mod-php7 (Ubuntu 16.04).

0

bkzland answered the question directly, but I would like to offer you a different solution for local Web development with LAMP on Ubuntu with Zend Community Edition - a little boost if you want it because you are just starting.

If you follow the Zend Community Edition link, above, you will find detailed instructions that work very well with minimal effort. Go with PHP 5.3. And notice that their instructions assume that you are logged in as the root user. (Because their shell commands begin with #) To become root...

sudo su -

And then the commands they provide will work for you, too. Get the extras, too: php-5.3-extra-extensions-zend-server, phpmyadmin-zend-server, zend-server-framework-dojo, zend-server-framework-extras.

I would not dive into the Zend Framework because you just beginning, but it's there if you want to play with it. If you go with a framework over pure PHP, CodeIgniter is a good framework to start with and maybe stick with. Also, download and install an IDE: a version of Eclipse with many built-in PHP plugins (Helios) or maybe Komodo Edit.

The website root will be in /var/www. Don't forget to set the PHP timezone. There's a Web GUI for that after installing at http://localhost:10081/ZendServer/. Server Setup -> Directives:

Zend Community Edition PHP Directives

Good luck!

0

I just got mine working by copying the presumed .php file to the html folder. Couldn't do it trough the files manager so sudo in the terminal.

sudo cp testphp.php /var/www/html/
-2

Maybe php has another package name? I don't know, i don't use it.

But you can try install this: http://www.apachefriends.org/en/xampp-linux.html I use it and it works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .