Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache et php
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
Jean-Francois
Apprentice
Apprentice


Joined: 24 Sep 2002
Posts: 191
Location: Grenoble

PostPosted: Tue Dec 17, 2002 11:31 pm    Post subject: Apache et php Reply with quote

Salut,

je ne parviens pas a faire tourner php avec apache.
J'ai emerge apache, mod_php et php mais le serveur n'interprete toujours pas les pages php.
Apparemment j'ai vu en parcourant les différents forum qu'il y avaient quelques problèmes mais je n'ai pas trouvé de réelle solution.

php 4.2.3
mod_php 4.2.3-r2
apache 1.3.27-r1

Si l'un de vous avait une idée....

Merci d'avance
_________________
Jean-Francois
http://bdml.free.fr
BdmL : Astronomie - Jeux de Societe - Linux - Photos
Back to top
View user's profile Send private message
Atreillou
Apprentice
Apprentice


Joined: 29 Oct 2002
Posts: 257

PostPosted: Wed Dec 18, 2002 1:04 am    Post subject: Reply with quote

t'as fait ca ?


https://forums.gentoo.org/viewtopic.php?t=23203&highlight=apache
Back to top
View user's profile Send private message
sergio
Apprentice
Apprentice


Joined: 11 Jun 2002
Posts: 265
Location: Clermont Ferrand, France

PostPosted: Wed Dec 18, 2002 7:21 am    Post subject: Reply with quote

Va voir le topic à l'url suivante

https://forums.gentoo.org/viewtopic.php?t=16392

Celui-ci concerne Apache, PHP et Oracle mais tu peut passer sous silence la partie Oracle...

Pour le reste je pense cela devrait être utile...


A+
Back to top
View user's profile Send private message
Tucs
n00b
n00b


Joined: 24 Sep 2002
Posts: 45

PostPosted: Wed Dec 18, 2002 8:59 am    Post subject: Reply with quote

regardes dans /var/log/apache/error_log

normalment si il y a un pb avec php, il t'indique une erreur, sinon, ca veut dire que le php n'est pas du tout configure.
Back to top
View user's profile Send private message
Neo-einstein
n00b
n00b


Joined: 17 Dec 2002
Posts: 27
Location: Luxembourg

PostPosted: Wed Dec 18, 2002 10:06 am    Post subject: Re: Apache et php Reply with quote

Jean-Francois wrote:
Salut,

je ne parviens pas a faire tourner php avec apache.
J'ai emerge apache, mod_php et php mais le serveur n'interprete toujours pas les pages php.


En general, il faut chipoter dans les fichiers de config d'Apache (http.conf) et de php (php.ini). La documentation sur www.php.net/docs.php et très bien !

Pour simplifier voici le install.txt (la solution s'y trouve sûrement) :

Quote:
Installation Instructions for PHP 4
-----------------------------------

STOP!

Before going any further, please remember you are going to find more
up to date instructions in the online manual, located here:

http://www.php.net/manual/en/install.apache.php

It is strongly recommended that you read the manual page before going
further. However, for the impatient, here is a quick set of steps that
will build PHP as (first) a dynamic Apache module (DSO) for Apache 1.3.x
with MySQL support and then a static module. A more verbose explanation follows.

For installing PHP on other web servers, refer to one of the following
files:

sapi/aolserver/README
sapi/pi3web/README
sapi/servlet/README
sapi/thttpd/README
README.Zeus

Some notes:

1: Only install either the static module or the dynamic one. Do not
install both.

2: If you are recompiling PHP to add new extensions or upgrading
something like GD, remove the config.cache file before you re-run
configure.

3: If you are on Linux and have installed shared libraries, make
sure the location of these shared libraries are listed in your
/etc/ld.so.conf file. For example, if you have:

/usr/local/lib/mysql/libmysqlclient.so

Make sure /etc/ld.so.conf contains:

/usr/local/lib/mysql

Then run ldconfig.

If you want both PHP 3 and 4 modules in the same Apache server, check the
bottom of this file for instructions.

INSTALLATION WITH THE ZEUS WEB SERVER:
--Please see the 'README.Zeus' file included in this distribution


QUICK INSTALL (DSO)

For this to work your Apache httpd must have mod_so enabled.
Check using httpd -l. You should see something like:

Compiled-in modules:
http_core.c
mod_so.c

Chances are you will see a lot more modules than these two. That's ok,
as long as mod_so.c shows up you can proceed with the following steps:

$ gunzip -c php-4.x.y.tar.gz | tar xf -
$ cd php-4.x.y
$ ./configure --with-mysql --with-apxs
$ make
$ make install

If you get an error telling you that the apxs script could not be found,
look for it on your system and if you find it, provide the full path to it
as: --with-apxs=/path/to/apxs

Next you must copy php.ini-dist to the appropriate place (normally
/usr/local/lib/php.ini) and edit it as necessary to set PHP options.

The only thing left to do is to edit your httpd.conf file and make sure the
PHP 4 mime type is there and uncommented. You need a line that looks like
this:

AddType application/x-httpd-php .php

Then restart your server (apachectl restart) and you should be able to
serve up PHP files now. Make a test file called test.php and put some
PHP tags in it. Like <?phpinfo()?>, for example.


QUICK INSTALL (Static)

$ gunzip -c apache_1.3.x.tar.gz | tar xf -
$ cd apache_1.3.x
$ ./configure
$ cd ..

$ gunzip -c php-4.x.y.tar.gz | tar xf -
$ cd php-4.x.y
$ ./configure --with-mysql --with-apache=../apache_1.3.x
$ make
$ make install

$ cd ../apache_1.3.x
$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
(The above line is correct! Yes, we know libphp4.a does not exist at this
stage. It isn't supposed to. It will be created.)
$ make
(you should now have an httpd binary which you can copy to your Apache bin dir if
is is your first install then you need to "make install" as well)
$ cd ../php-4.x.y
$ cp php.ini-dist /usr/local/lib/php.ini
You can edit /usr/local/lib/php.ini file to set PHP options.
Edit your httpd.conf or srm.conf file and add:
AddType application/x-httpd-php .php


VERBOSE INSTALL

Chances are you are reading this because the quick install steps above
did not work for you. If this is the case, congratulations, you are
among the elite few that actually reads documentation. It really is
not a difficult install and once you have done it once you will fly
through it.

Installing PHP can be done in four simple steps:

1. Unpack your distribution file.

You will have downloaded a file named something like php-4.x.y.tar.gz.
Unzip this file with a command like: gunzip php-4.x.y.tar.gz

Next you have to untar it with: tar -xvf php-4.x.y.tar

This will create a php-4.x.y directory. cd into this new directory.

2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build
a static module

You now have to choose the options you would like. There are quite
a few of them. To see a list, type: ./configure --help

The only options that you are likely to want to use are the ones in
the last section entitled, "--enable and --with options recognized:"

A popular choice is to build the Apache module version. In order to
build PHP as a dynamic module for Apache-1.3.x you have to first have
Apache installed. Assuming Apache is already installed, make sure
the shared object module is enabled. To check this, type: httpd -l
You should see something like:

Compiled-in modules:
http_core.c
mod_so.c

You will most likely have a lot more modules than what is shown here.
As long as mod_so.c shows up in the list, PHP should be happy.

Now, type: ./configure --with-mysql --with-apxs

If you get an error telling you that the apxs script could not be found,
look for it on your system and if you find it, provide the full path to it
as: --with-apxs=/path/to/apxs

You might also want other flags on this configure line. --with-mysql
is just an example.

There are a few things that can go wrong during this configure step.
The most common is that you have asked for an option and that the
configure script can not find the files required to enable this
option in PHP. Chances are you can provide the full path to the
base directory under which the related files were installed. For
example, if you have installed the GD library in /opt/gd which means
that /opt/gd/include has your GD header files and /opt/gd/lib contains
your GD library files, you would use --with-gd=/opt/gd

Skip to step 3 for compilation and installation instructions.

2b. Configure PHP (Static Module) - Skip if you performed 2a

You now have to choose the options you would like. There are quite
a few of them. To see a list, type: ./configure --help

The only options that you are likely to want to use are the ones in
the last section entitled, "--enable and --with options recognized:"

A popular choice is to build the Apache module version. You need
to know where the source code directory for your Apache server is
located. Then use an option like: --with-apache=/usr/local/src/apache
if that is your Apache source code directory. If you only specify
--with-apache, then it will default to look for your Apache source
in /usr/local/etc/httpd.

NOTE: The directory you specify should be the top-level of the
unpacked Apache (or Stronghold) distribution. The configure program
will automatically look for httpd.h in different directories under that
location depending on which version of Apache, including Stronghold,
you are running.

For MySQL support, since newer versions of MySQL installs its various
components under /usr/local, this is the default. If you have
changed the location you can specify it with: --with-mysql=/opt/local
for example. Otherwise just use: --with-mysql

*NOTE* If you are using Apache 1.3b6 or later, you should run the
Apache Configure script at least once before compiling PHP. It
doesn't matter how you have Apache configured at this point.

Skip to step 3b at this point.

3. Compile and install the files. Simply type: make install

3a. Dynamic Module Installation

Nothing else is needed here. Proceed to step 4a.

3b. Static Module Installation

For the Apache module version this will copy the appropriate files
to the src/modules/php4 directory in your Apache distribution if
you are using Apache 1.3.x. If you are still running Apache 1.2.x
these files will be copied directly to the main src directory.

For Apache 1.3b6 and later, you can use the new APACI configuration
mechanism. To automatically build Apache with PHP support, use:

cd apache_1.3.x
./configure --prefix=/<path>/apache \
--activate-module=src/modules/php4/libphp4.a
make
make install

If you do not wish to use this new configuration tool, the old
install procedure (src/Configure) will work fine.

If you are using the old Apache ./Configure script, you will have to
edit the Apache src/Configuration file manually. If you do not have
this file, copy Configuration.tmpl to Configuration.

For Apache 1.3.x add:

AddModule modules/php4/libphp4.a

For Apache 1.3.x don't do anything else. Just add this line and then
run "./Configure" followed by "make".

For Apache 1.2.x add:

Module php4_module mod_php4.o

For Apache 1.2.x you will also have to look in the libphp4.module file,
which was copied to the src directory. The EXTRA_LIBS line in the Apache
Configuration file needs to be set to use the same libs as specified on
the LIBS line in libphp4.module. You also need to make sure to add
"-L." to the beginning of the EXTRA_LIBS line.

So, as an example, your EXTRA_LIBS line might look like:

EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient

NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
is in the libphp4.module file.

Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file
and set the WANTHSREGEX directive accordingly in your Configuration file.
This last step applies to versions of Apache prior to 1.3b3.

This is a bit of a hassle, but should serve as incentive to move to
Apache 1.3.x where this step has been eliminated.

Once you are satisfied with your Configuration settings, type: ./Configure
If you get errors, chances are that you forgot a library or made a typo
somewhere. Re-edit Configuration and try again. If it goes well,
type: make

Assuming it compiles without errors, proceed to step 4b.

4a. Setting up the server. (Dynamic Module)

The make install command in step 3 should have done most of your
work for you. It actually edits your httpd.conf file and tries to
enable the dynamic PHP module. To verify this, look for a line that
looks like this:

LoadModule php4_module libexec/libphp4.so

The actual path before the libphp4.so part might differ slightly. This
is likely fine. If you are paranoid you can examine the output from the
make install step to see where the libphp4.so file was actually put and
place the full path to this file on this LoadModule line.

If somewhere in your httpd.conf file you have a ClearModuleList line
then you also need this line:

AddModule mod_php4.c

And finally you need to tell Apache which file extension should trigger
PHP. You do this by creating a special mime type and associating it
with an extension. We suggest using:

AddType application/x-httpd-php .php

You are however free to use any extension you wish, including .html.

Note! If a line has a # at the beginning, then it is commented out
and you need to remove the # for that line to take effect.

Finally you need to copy php.ini-dist to the appropriate place
(normally /usr/local/lib/php.ini) and edit if necessary.

Once you have made these changes you should be ready to restart your
server and try it out. Type: apachectl restart

4b. Setting up the server. (Static Module)

You should now have a new httpd binary. Shut down your existing server,
if you have one, and copy this new binary overtop of it. Perhaps make
a backup of your previous one first. Then edit your conf/httpd.conf file
and add the line:

AddType application/x-httpd-php .php

There is also an interesting feature which can be quite instructive and
helpful while debugging. That is the option of having colour syntax
highlighting. To enable this, add the following line:

AddType application/x-httpd-php-source .phps

Any file ending in .phps will now be displayed with full colour syntax
highlighting instead of being executed.

Note that on some older server setups, the AddType lines are in the
conf/srm.conf file instead of conf/httpd.conf.

Note! If a line has a # at the beginning, then it is commented out
and you need to remove the # for that line to take effect.

When you are finished making changes to your httpd.conf file, you need
to copy php.ini-dist to the appropriate place (normally
/usr/local/lib/php.ini) and edit if necessary. You can then
start up your server.

5. Testing it all worked

Create a test file named test.php in your web tree somewhere and
put some test PHP tags in it. <?phpinfo()?> is a good first test.
This tag tells PHP to do a braindump and tells you all sorts of things
about itself.


WHY DISABLING -fPIC WORKS ON LINUX

From: Martin v. Loewis <martin@loewis.home.cs.tu-berlin.de>
To: glibc-linux@ricardo.ecn.wfu.edu
Subject: Re: Shared library -shared vs. -fpic

[In reply to Kaz Kylheku <kaz@ashi.footprints.net>]

> PIC stands for Position-Independent Code.

Correct.

> Code isn't position-independent (or ``relocatable'') cannot be
> loaded at an arbitrary address;

Wrong.

> it requires some references to be patched at load time.

Correct.

> Shared libraries need to be relocatable because it's not known
> beforehand what address they will be loaded at

Correct, depending on the meaning of "relocatable". PIC code typically
does not contain relocations; that's why its position-independent.

> Just because you don't specify -fPIC doesn't mean that the compiler
> won't emit position-independent code; the option prevents it from
> emitting position-dependent code in situations where it otherwise
> would.

Correct. However, a non-trivial shared library typically won't be
position-independent unless explicitly compiled with
-fPIC. Linux/glibc indeed does not require a shared library to be
position-independent; instead, it will perform the relocations in the
binary, even if they refer to code pages. As a result, those relocated
pages won't be shared across processes, anymore.

Regards,
Martin

USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES

With some (newer) installations of Apache, it's possible to compile both
PHP 3 and PHP 4, and run them concurrently.

Note, it's only really wise to do this if you need to use the PHP 3 engine
to maintain backwards compatibility.

To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the
necessary link extensions (--enable-versioning). Otherwise, all standard
installations instructions apply. For example:

$ ./configure \
--with-apxs=/apache/bin/apxs \
--enable-versioning \
--with-mysql \

_________________
n-e
Back to top
View user's profile Send private message
Mat_le_ouf
Apprentice
Apprentice


Joined: 13 Sep 2002
Posts: 257
Location: France

PostPosted: Wed Dec 18, 2002 11:07 am    Post subject: Reply with quote

Pas besoin de tant se compliquer la vie, normalement avec le lien d'Atreillou tout devrait fonctionner.
Back to top
View user's profile Send private message
Neo-einstein
n00b
n00b


Joined: 17 Dec 2002
Posts: 27
Location: Luxembourg

PostPosted: Thu Dec 19, 2002 9:50 am    Post subject: Reply with quote

Mat_le_ouf wrote:
Pas besoin de tant se compliquer la vie, normalement avec le lien d'Atreillou tout devrait fonctionner.


C'est pas complique ? Faut juste mettre deux ligne dans httpd.conf est une ou deux dans php.ini ;)
_________________
n-e
Back to top
View user's profile Send private message
Sleeper
l33t
l33t


Joined: 12 Nov 2002
Posts: 667

PostPosted: Thu Dec 19, 2002 9:58 am    Post subject: Reply with quote

Ben faire un quote de 200 lignes pour dire ensuite qu'il y a 3 lignes a modifier, ca semble un peu complique non ??
Back to top
View user's profile Send private message
Neo-einstein
n00b
n00b


Joined: 17 Dec 2002
Posts: 27
Location: Luxembourg

PostPosted: Thu Dec 19, 2002 10:14 am    Post subject: Reply with quote

Bon d'accord j'avoue avoir ete un peu paresseux :(

Mais j'avais le readme justement entre les main ;)
_________________
n-e
Back to top
View user's profile Send private message
Neo-einstein
n00b
n00b


Joined: 17 Dec 2002
Posts: 27
Location: Luxembourg

PostPosted: Thu Dec 19, 2002 10:16 am    Post subject: Reply with quote

mainS, naturellement :oops:
_________________
n-e
Back to top
View user's profile Send private message
Mat_le_ouf
Apprentice
Apprentice


Joined: 13 Sep 2002
Posts: 257
Location: France

PostPosted: Thu Dec 19, 2002 11:35 am    Post subject: Reply with quote

Neo-einstein wrote:
Bon d'accord j'avoue avoir ete un peu paresseux :(

Mais j'avais le readme justement entre les main ;)

T'aurais pu mettre simplement un lien vers ce Readme, doit pas etre tres dur a trouver sur le net...
Mais bon la paresse :wink:
Back to top
View user's profile Send private message
Neo-einstein
n00b
n00b


Joined: 17 Dec 2002
Posts: 27
Location: Luxembourg

PostPosted: Thu Dec 19, 2002 12:23 pm    Post subject: Reply with quote

Est-ce que Jean-Francois a regler son probleme finallement, ou non ?
Ce n'est pas que je veuille devie du sujet, mais bon :roll: !
_________________
n-e
Back to top
View user's profile Send private message
Mat_le_ouf
Apprentice
Apprentice


Joined: 13 Sep 2002
Posts: 257
Location: France

PostPosted: Thu Dec 19, 2002 5:12 pm    Post subject: Reply with quote

Pas de nouvelles, bonnes nouvelles :)
Back to top
View user's profile Send private message
Jean-Francois
Apprentice
Apprentice


Joined: 24 Sep 2002
Posts: 191
Location: Grenoble

PostPosted: Sun Dec 22, 2002 10:38 pm    Post subject: Désolé de vous avoir fait attendre... Reply with quote

Période de fêtes oblige, je n'ai pas eu trop le temps de me repencher la dessus. J'ai juste essayé ce qui est décrit dans le lien donné par Atreillou, et ca n'a pas suffit.

J'approfondirais les tests à mon retour de vacances :-)

Merci de votre aide à tous et à bientôt.
_________________
Jean-Francois
http://bdml.free.fr
BdmL : Astronomie - Jeux de Societe - Linux - Photos
Back to top
View user's profile Send private message
Atreillou
Apprentice
Apprentice


Joined: 29 Oct 2002
Posts: 257

PostPosted: Mon Dec 23, 2002 7:34 am    Post subject: Reply with quote

bonnes vacances à toi !!
Back to top
View user's profile Send private message
Jean-Francois
Apprentice
Apprentice


Joined: 24 Sep 2002
Posts: 191
Location: Grenoble

PostPosted: Sat Dec 28, 2002 11:01 pm    Post subject: Ca marche Reply with quote

A mon retour j'ai fait

emerge rsync
emerge -u world
J'ai fait du ménage dans mes ._cfg...

Ce soir je me repenche sur le problème php/apache : ça fonctionne maintenant nickel !

Comme quoi j'ai bien fait de partir en vacances ;-)
_________________
Jean-Francois
http://bdml.free.fr
BdmL : Astronomie - Jeux de Societe - Linux - Photos
Back to top
View user's profile Send private message
Mat_le_ouf
Apprentice
Apprentice


Joined: 13 Sep 2002
Posts: 257
Location: France

PostPosted: Sun Dec 29, 2002 10:46 am    Post subject: Reply with quote

La magie de Linux ;)
A mon avis tu devais avoir des fichiers de configuration plus à jour ou qque chose comme ça...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum