Results 1 to 10 of 12
Hey guys,
I'm running a fresh install of Debian
I'm trying to get php5 via apt-get, but it's not working. Here's what I'm doing
apt-get install php5
Here is the ...
- 01-20-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 59
Trying to install php with apt-get... Not working
Hey guys,
I'm running a fresh install of Debian
I'm trying to get php5 via apt-get, but it's not working. Here's what I'm doing
apt-get install php5
Here is the output
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package php5
Any ideas...?
- 01-20-2011 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
The package name is not php5 or you do not have a repository in /etc/apt/sources.list that has the PHP package.Code:E: Couldn't find package php5
- 01-20-2011 #3
The Debian package is called php5.
Which means you either don't have the correct repo in your sources.list or your haven't sync'd with the repos.
First try
Failing that post the contents of /etc/apt/sources.listCode:apt-get update && apt-get install php5
- 01-21-2011 #4Just Joined!
- Join Date
- Jan 2011
- Posts
- 59
Thanks guys! When I get to the office, I will post the contents of the sources.list file.
First, I have a few basic questions about this file
1) What IS this file?
2) What does it mean when I don't have the correct repo in this file? I.e. what is a "correct repo?"
3) What does it mean to sync with the repos?
4) What happens when I don't have the repo that has the PHP package, as HROAdmin26 said? Isn't the purpose of apt-get to download and install the package?
Thanks!
- 01-21-2011 #5Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
Apt isn't some magical application that pulls info about packages out of thin air. Things *change* and are updated - apt has to know where to look to get information about the latest packages, etc.
Google: apt-get sources.list debian
- 01-21-2011 #6
A repository is a collection of software packages. There are official repositories maintained by the developers of a particular distro, and unofficial repositories maintained by members of the community. The official repos should, in theory, maintain higher quality assurance that said software is safe, can meet all it's dependencies, and will work properly with your system. Unofficial repos are generally considered use at your own risk, but there are some well known ones (Debian Multimedia for example) that are generally considered safe.
apt-get has to download the package from some host, be it local on your computer, on a CD, or from the internet. The sources.list file details where to look for packages, again, be it on the internet, locally, or from a CD.
An entry in that file generally looks like
In Debian, you would find something likeCode:deb http://site.example.com/debian distribution component1 component2 component3
So when you use apt, it looks to the above URL, it says you're using the lenny release. (You can also use stable here, of if you're running squeeze, testing.) And it says you have 3 sections enabled, main, contrib, and non-free.Code:deb http://ftp.us.debian.org/debian/ lenny main contrib non-free
Different software is in different sections, which you can find more about in the link I posted there. But quickly, if a piece of software is in contrib, and you don't have contrib enabled, apt can't find it.
Finally, before apt knows what software is available, it needs to sync with the repository, ie, there's a file in the repository that lists all the available packages and version, which apt scans and stores. When you try to install software with apt, it looks to that info, says, yup, there's a package php5 there, then connects to the repository and attempts to download it.
Advanced Packaging Tool - Wikipedia, the free encyclopedia
- 01-21-2011 #7
This can be handy as well for helping to configure your sources.list
Debian Sources List Generator
- 01-29-2011 #8Just Joined!
- Join Date
- Jan 2011
- Posts
- 59
Trying to install PHP with apt-get... Not working!
What am I doing wrong? I'm reading every tutorial about installing PHP, but nothing is working
Arrrrgghh, I'm driving myself insane. What am I doing wrong? I'm using Debian if that matters.Code:mainserver:/var/www# apt-get install php5 Reading package lists... Done Building dependency tree Reading state information... Done php5 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded. mainserver:/var/www# php bash: php: command not found mainserver:/var/www#
For what it's worth, here is the result of apt-cache search php- which shows that php5 IS installed.... but it's not recognized at the terminal when i type "php"
Code:mainserver:/var/www# apt-cache search php5- php5-cgi - server-side, HTML-embedded scripting language (CGI binary) php5-cli - command-line interpreter for the php5 scripting language php5-common - Common files for packages built from the php5 source php5-curl - CURL module for php5 php5-dbg - Debug symbols for PHP5 php5-dev - Files for PHP5 module development php5-gd - GD module for php5 php5-gmp - GMP module for php5 php5-imap - IMAP module for php5 php5-interbase - interbase/firebird module for php5 php5-ldap - LDAP module for php5 php5-mcrypt - MCrypt module for php5 php5-mhash - MHASH module for php5 php5-ming - Ming module for php5 php5-mysql - MySQL module for php5 php5-odbc - ODBC module for php5 php5-pgsql - PostgreSQL module for php5 php5-pspell - pspell module for php5 php5-recode - recode module for php5 php5-snmp - SNMP module for php5 php5-sqlite - SQLite module for php5 php5-sybase - Sybase / MS SQL Server module for php5 php5-tidy - tidy module for php5 php5-xmlrpc - XML-RPC module for php5 php5-xsl - XSL module for php5 php5-apc - apc module for php5 php5-ffmpeg - ffmpeg module for php5 php5-geoip - geoip module for php5 php5-http - http module for php5 php5-imagick - imagick module for php5 php5-memcache - memcache module for php5 php5-spplus - spplus module for php5 php5-ssh2 - ssh2 module for php5 php5-suhosin - suhosin module for php5 php5-xcache - xcache module for php5 php5-xdebug - xdebug module for php5 php5-mapscript - php5-cgi module for MapServer mainserver:/var/www#
- 01-29-2011 #9
The output from the first command shows that php is already installed. PHP is not usually run in a terminal. You create php files, load them to wherever your webserver expects to find web documents and then access the php pages from you web browser. This guide may help.
- 01-29-2011 #10Just Joined!
- Join Date
- Jan 2011
- Posts
- 59
Hi Daark Child, thanks for the response. I went through the tutorial, however I still get the error bash: php: command not found when I type PHP. Why does it do this, yet show that PHP is installed when I type apt-cache search php5-? Perl works fine on command line, and all the tutorials about installing PHP indicate that typing php -v on command line is the way to verify that it's installed

Also, when I navigate to any PHP/Perl webpage (whether or not the file actually exists in my /var/www/ directory) I get a 403 (Forbidden) error. Again, this error occurs whether or not the php/perl file I am trying to access exists or not. Plain HTML files work fine...
Anyway, I've attached the output for each step in the tutorial you had sent me. Perhaps it might indicate something?
aptitude install mysql-server mysql-client
aptitude install apache2Code:mainserver:/home/robot# aptitude install mysql-server mysql-client Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done The following packages are BROKEN: mysql-client-5.1 mysql-server-5.1 The following NEW packages will be installed: libmysqlclient16{a} mysql-client mysql-server mysql-server-core-5.1{a} The following packages will be upgraded: mysql-common 1 packages upgraded, 6 newly installed, 0 to remove and 6 not upgraded. Need to get 22.1MB of archives. After unpacking 51.1MB will be used. The following packages have unmet dependencies: mysql-server-5.1: Depends: libdbi-perl which is a virtual package. mysql-client-5.1: Depends: libdbi-perl which is a virtual package. Depends: libdbd-mysql-perl (>= 1.2202) which is a virtual package. The following actions will resolve these dependencies: Keep the following packages at their current version: mysql-client [Not Installed] mysql-client-5.1 [Not Installed] mysql-server [Not Installed] mysql-server-5.1 [Not Installed] Score is -19794 Accept this solution? [Y/n/q/?] Y The following packages will be upgraded: mysql-common 1 packages upgraded, 0 newly installed, 0 to remove and 6 not upgraded. Need to get 76.3kB of archives. After unpacking 32.8kB will be freed. Do you want to continue? [Y/n/?] Y WARNING: untrusted versions of the following packages will be installed! Untrusted packages could compromise your system's security. You should only proceed with the installation if you are certain that this is what you want to do. mysql-common Do you want to ignore this warning and proceed anyway? To continue, enter "Yes"; to abort, enter "No": Yes Writing extended state information... Done Get:1 URL-BLOCKED-OUT stable/all mysql-common 5.1.54-0.dotdeb.0 [76.3kB] Fetched 76.3kB in 1s (68.1kB/s) (Reading database ... 58162 files and directories currently installed.) Preparing to replace mysql-common 5.0.51a-24+lenny5 (using .../mysql-common_5.1.54-0.dotdeb.0_all.deb) ... Unpacking replacement mysql-common ... Setting up mysql-common (5.1.54-0.dotdeb.0) ... Installing new version of config file /etc/mysql/my.cnf ... Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done Current status: 6 updates [-1].
aptitude install php5 libapache2-mod-php5Code:mainserver:/home/robot# aptitude install apache2 Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done The following NEW packages will be installed: apache2 0 packages upgraded, 1 newly installed, 0 to remove and 6 not upgraded. Need to get 45.9kB of archives. After unpacking 102kB will be used. Writing extended state information... Done Get:1 URL-BLOCKED-OUT lenny/updates/main apache2 2.2.9-10+lenny9 [45.9kB] Fetched 45.9kB in 0s (76.8kB/s) Selecting previously deselected package apache2. (Reading database ... 58164 files and directories currently installed.) Unpacking apache2 (from .../apache2_2.2.9-10+lenny9_all.deb) ... Setting up apache2 (2.2.9-10+lenny9) ... Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done Writing extended state information... Done Reading task descriptions... Done
/etc/init.d/apache2 restartCode:mainserver:/home/robot# aptitude install php5 libapache2-mod-php5 Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 6 not upgraded. Need to get 0B of archives. After unpacking 0B will be used. Writing extended state information... Done Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done
Does this help with anything?Code:mainserver:/home/robot# /etc/init.d/apache2 restart Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName .
Thanks for your assistance!


Reply With Quote
