Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Debian 3.1: PHP install strategies

6 views
Skip to first unread message

bruce_...@my-deja.com

unread,
Aug 16, 2006, 8:09:48 AM8/16/06
to
I have recently installed Debian Sarge 3.1.
This includes Apache 2.

I now want to install PHP4.

* How can I query whether Apache2 has the correct modules installed so
it is set up OK to run PHP scripts? Web resources mention that I may
need to recompile Apache especially to support PHP.
* Install strategies welcomed.

Thanks
Bruce

alexd

unread,
Aug 16, 2006, 2:44:14 PM8/16/06
to
bruce_...@my-deja.com wrote:

> I have recently installed Debian Sarge 3.1.
> This includes Apache 2.
>
> I now want to install PHP4.
>
> * How can I query whether Apache2 has the correct modules installed so
> it is set up OK to run PHP scripts?

Tough one. You could always create a file called something.php with

<?php
phpinfo();
?>

in it, and see if it loads. Failing that,

$ grep php /etc/apache2/{httpd,modules}.conf

[or whatever it's called] to see if it's referenced at all. Also,

$ locate libphp4.so

may or may not yield something.

> Web resources mention that I may
> need to recompile Apache especially to support PHP.

Unlikely. Debian Apache comes with loadable module support, as probably does
every other distro's version of Apache.

$ apt-cache search apache2 php
apache2-prefork-dev - development headers for apache2
libapache-mod-php4 - server-side, HTML-embedded scripting language (apache
1.3 module)
libapache-mod-php5 - server-side, HTML-embedded scripting language (apache
1.3 module)
libapache2-mod-php4 - server-side, HTML-embedded scripting language (apache
2.0 module)
libapache2-mod-php5 - server-side, HTML-embedded scripting language (apache
2.0 module)
libapache2-mod-suphp - Apache2 module to run php scripts with the owner
permissions
php4-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cgi - server-side, HTML-embedded scripting language (CGI binary)


$ apt-cache show libapache2-mod-php4
Package: libapache2-mod-php4
<snip>
Description: server-side, HTML-embedded scripting language (apache 2.0
module)
This package provides the PHP4 module for the Apache 2.0 webserver (as
found in the apache2-mpm-prefork package). Please note that this package
ONLY works with Apache's prefork MPM, as it is not compiled thread-safe.
To use php4 with Apache 1.3, you probably want libapache-mod-php4 instead.
<snip>

> * Install strategies welcomed.

apt-get install libapache2-mod-php4

Job done. Gotta love Debian.

--
<http://ale.cx/> (AIM:troffasky) (UnSoEs...@ale.cx)
19:32:57 up 23 days, 54 min, 2 users, load average: 0.23, 0.82, 1.14
This is my BOOOOOOOOOOOOOOOOOOOOOMSTICK

Nick Leverton

unread,
Aug 16, 2006, 3:53:45 PM8/16/06
to
In article <1155730188.2...@74g2000cwt.googlegroups.com>,

apt-get install libapache2-mod-php4

might be a good place to start. It's some time since I used it myself,
so I don't remember whether you have to a2enmod by hand or whether it
does that for you.

Nick

MJ Ray

unread,
Aug 17, 2006, 6:05:16 AM8/17/06
to
bruce_...@my-deja.com

> * How can I query whether Apache2 has the correct modules installed so
> it is set up OK to run PHP scripts?

At a guess, curl -I http://localhost and see if it says PHP on the Server.

> Web resources mention that I may
> need to recompile Apache especially to support PHP.

Many web resources also tell you to make your web directory world-writeable,
which is usually a bad idea. Don't believe everything on the web.

You may want to recompile Apache to *optimise* PHP, but not to support it.

> * Install strategies welcomed.

Look for the appropriate php4-cgi or libapache2-mod-php4 package. I'm
not sure, but I think using libapache2-mod-ruid with libapache2-mod-php4
looks favourite at the moment. Comments?
--
MJR/slef
My Opinion Only: see http://people.debian.org/~mjr/
Please follow http://www.uk.debian.org/MailingLists/#codeofconduct


bruce_...@my-deja.com

unread,
Aug 17, 2006, 6:10:31 AM8/17/06
to

>
> > * Install strategies welcomed.
>
> Look for the appropriate php4-cgi or libapache2-mod-php4 package. I'm
> not sure, but I think using libapache2-mod-ruid with libapache2-mod-php4
> looks favourite at the moment. Comments?
> --

dpkg -i libapache-mod-php4_4.3.10-16_i386.deb
Selecting previously deselected package libapache-mod-php4.
(Reading database ... 75606 files and directories currently installed.)
Unpacking libapache-mod-php4 (from
libapache-mod-php4_4.3.10-16_i386.deb) ...
dpkg: dependency problems prevent configuration of libapache-mod-php4:
libapache-mod-php4 depends on libzzip-0-12 (>= 0.12.83); however:
Package libzzip-0-12 is not installed.
libapache-mod-php4 depends on apache-common (>= 1.3.33); however:
Package apache-common is not installed.
libapache-mod-php4 depends on php4-common (= 4:4.3.10-16); however:
Package php4-common is not installed.
dpkg: error processing libapache-mod-php4 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libapache-mod-php4
-----
Looks like I need to install more supporting packages first.
PS: apt-get just looks on my CD drive -- I can't figure out how to edit
the apt-get config file to change this.
Bruce

Gordon Henderson

unread,
Aug 17, 2006, 6:36:43 AM8/17/06
to
In article <1155809431.2...@75g2000cwc.googlegroups.com>,

Edit /etc/apt/sources.list

I have the following in mine:

deb http://www.debian-multimedia.org stable main
deb http://debian.blueyonder.co.uk/ stable main non-free contrib
deb http://security.debian.org/ stable/updates main contrib non-free

Run

apt-get update
and you might as well run
apt-get upgrade
to get all the latest securty upgrades at the same time.

Then use something like dselect or the newer aptitude to select
packages. This will work out and resolve the dependancies for you.

From a personal point of view, I tend to use Debian just to get a basic
installation going, then I download and install packages like apache,
php, mysql directly from the original web sites to get things installed
the way I want them, however this isn't without its problems either,
but since I've been doing itthat way on many different platforms (Various
Linux flavours, Solairs, HP, ,*BSD, etc.) for many years, it works for me.

Gordon

bruce_...@my-deja.com

unread,
Aug 17, 2006, 7:17:43 AM8/17/06
to
>
> Edit /etc/apt/sources.list
>
> I have the following in mine:
>
> deb http://www.debian-multimedia.org stable main
> deb http://debian.blueyonder.co.uk/ stable main non-free contrib
> deb http://security.debian.org/ stable/updates main contrib non-free

Thanks, Gordon. But I am using a dial up modem, so I prefer to download
packages at work, then install from my hard disk at home.

All PHP packages are now installed and apache2 config files edited
appropriately as shown in the PHP online manual.
But when I load a sample .php file into Mozilla it prompts me for an
application to use to open it.
Any ideas on this? I am *nearly* there!
Bruce

Gordon Henderson

unread,
Aug 17, 2006, 10:57:04 AM8/17/06
to
In article <1155813463....@74g2000cwt.googlegroups.com>,

Sure you've got the apache configs setup right?

A grep of one of my httpd.conf files shows:

LoadModule php4_module modules/libphp4.so
DirectoryIndex index.html index.html.var index.htm index.php
AddType application/x-httpd-php .php .phtml

create this as (eg) test.php:

<? phpinfo(); ?>

and if you get that working, the rest will "just work"..

Gordon

Darren Salt

unread,
Aug 20, 2006, 8:40:46 AM8/20/06
to
I demand that Gordon Henderson may or may not have written...

[snip]


>> PS: apt-get just looks on my CD drive -- I can't figure out how to edit
>> the apt-get config file to change this.

> Edit /etc/apt/sources.list

> I have the following in mine:

> deb http://www.debian-multimedia.org stable main
> deb http://debian.blueyonder.co.uk/ stable main non-free contrib
> deb http://security.debian.org/ stable/updates main contrib non-free

You *should* also have this line, mainly to cope with release updates:

deb http://ftp.uk.debian.org/debian stable main contrib non-free


> apt-get update
> and you might as well run
> apt-get upgrade
> to get all the latest securty upgrades at the same time.

> Then use something like dselect or the newer aptitude to select packages.
> This will work out and resolve the dependancies for you.

It would be better to check whether aptitude is already installed:
$ which aptitude

If not (no output):
# apt-get update; apt-get install aptitude

With aptitude installed, you can use
# aptitude update

Then
# aptitude upgrade

Or if you'd rather use aptitude's UI:
# aptitude

Press 'u' to start an update; or press 'g' for a list of upgradable packages,
then again to start the upgrade. 'q' to close the current view (and the whole
program if that was the only one). '?' for help.

> From a personal point of view, I tend to use Debian just to get a basic
> installation going, then I download and install packages like apache, php,
> mysql directly from the original web sites to get things installed the way

> I want them, [...]

First, copy a few 'deb' lines, replacing 'deb' with 'deb-src', then
# aptitude update

$ apt-get source $PACKAGE
$ sudo apt-get build-dep $PACKAGE # should really be done by aptitude :-|
$ cd $PACKAGE-$VERSION
... hack away, possibly modify debian/changelog ...
$ debuild
$ sudo dpkg -i ../$PACKAGE_$VERSION_$ARCH.deb

--
| Darren Salt | linux or ds at | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
| + Lobby friends, family, business, government. WE'RE KILLING THE PLANET.

I'd like to, but I have too much guilt.

0 new messages