# HOWTO Install PHP5

## ScriptBlue

Side Note:

This is the overlay mentioned here in package.mask

 *Quote:*   

> # Stuart Herbert <stuart@gentoo.org> (10 Jun 2005)
> 
> # Masked until the eclass is finished, and the PECL packages are done
> 
> 

 

1)Download

http://dev.gentoo.org/~stuart/php/php-overlay.tar.gz

2)Unpack

Unpack the gziped tarball into /usr/local/portage so after you are done you should have /usr/local/portage/dev-lang/

3)Necessary programs

This may seem redunant however, do not forget to remove your previous PHP installationg ( emerge -C php ). You may have installed a couple of things with the name PHP, such as mod_php, and php cli. So you should run emerge -C php until emerge tells you no packages match that keyword.

If you are not using net-www/apache-2.0.54-r10 or above you will have to erase apache ( emerge -C apache ).

4)Editing settings

1: /etc/make.conf

Add the following line to /etc/make.conf so Portage's emerge will look in that directory

```
PORTDIR_OVERLAY=/usr/local/portage
```

I do not recommend this but it might be the method with the less headache.

Add the following line to make.conf and promptly remove it after installing PHP5

```
ACCEPT_KEYWORDS="~x86"
```

2: /etc/portage/package.keywords

This is for future use,

Add this line, (it will unmask the new php overlay) 

```
dev-lang/php ~x86
```

3:/etc/portage/package.use

This file will set the USE flags for your PHP installation and remember them without mass editing through make.conf

```
dev-lang/php cli cgi apache2 sockets
```

as well as

```
net-www/apache mpm-prefork
```

If you are wondering what mpm-prefork is check this link out, as well as other possibilies

http://httpd.apache.org/docs/2.0/mod/worker.html

http://webauthv3.stanford.edu/manual/mod/threadpool.html

http://httpd.apache.org/docs/2.0/mod/prefork.html

http://ecaimaps.berkeley.edu/manual/mod/leader.html

5)Checking packages

To see which packages will be emerged with what USE flags type

```
emerge -pv dev-lang/php
```

For PHP5 Apache should have ONE MPM, I suggest you use prefork because it is the most stable mod for Apache with PHP.

If you do not find a package you need either edit /etc/portage/package.use or use the USE="..." emerge ... flag

Note: there might be a filesize error with the ebuild, so you will have to cd /usr/portage/local/dev-lang and digest the ebuild like so,

```
ebuild [insert name of the ebuild] digest
```

7)Emerge

PHP5 needs DBA support so....

USE="dba" emerge dev-lang/php

6)Enjoy

After this you should be set but don't forget to actually emerge php  :Wink: 

Thanks to Stuart for writing such a great overlay as well as helping me install it.

Just in case you are wondering, here's my emerge package list

 *Quote:*   

> 
> 
> These are the packages that I would merge, in order:
> 
> Calculating dependencies ...done!
> ...

 

--------

This is my first how to, sorry if it doesn't follow the normal layout, I tried

----------

## stuherbert

Just a quick note to thank ScriptBlue for his HOWTO, and to let everyone know that, if PHP5 on Gentoo is important to you, this is your chance to see what it will look like when it's done - and to let me know whether it meets your needs or not.

Best regards,

Stu

----------

## stuherbert

Also, if you want to know what's going on with PHP5 support on Gentoo, follow my blog postings on Planet Gentoo.

Best regards,

Stu

----------

## whyscream

Another note to users trying this overlay for the first time:

the dev-lang/php ebuild can provide all of the previous php binaries. Choosing between them can be done via USE-flags:

```
dev-php/php: USE="cli"

dev-php/mod_php: USE="apache apache2" (one of these)

dev-php/php-cgi: USE="cgi"

```

Just in case you are waiting for an php emerge that compiles 2 binaries that you won't need  :Smile: 

----------

## mserms

Has anyone any experience of running PHP4 alongside PHP5 with the overlay tarball?

Also, FWIW, this recent version of the tarball (PHP5.1beta-r3) has fixed problems I was having with installing pecl extensions.

----------

## YD

Currently I'm using modified portage ebuilds. 

Does this tarball work well with MySQL4.1 + mysqli? 

Does it have independant mbstring flag (without nls support) ?

Is there any flag to install php-config/phpize without installing a separate package?

P.S. Also I had a problem when phpize generates a configure script which requires autoconf-2.13, but there are autoconf-2.5 macros. So I had to use WANT_AUTOCONF="2.5" emerge blablabla

----------

## andreask

Thanks for the great HOWTO!

A small side note: 

 *ScriptBlue wrote:*   

> If you are wondering what mpm-prefork is check this link out, as well as other possibilies
> 
> http://httpd.apache.org/docs/2.0/mod/worker.html
> 
> http://webauthv3.stanford.edu/manual/mod/threadpool.html
> ...

 

If you think about threaded MPMs as an alternative when using mod_php, you should consider this: http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2

edit:

And if you are interested in a more detailed explanation of the problem, read Rasmus following posting on php-dev:

http://groups.google.com/group/mailing.www.php-dev/msg/8f7db1ae9d726b6e

----------

## StifflerStealth

Great HOWTO, but you might want to expand this tutorial to cover setting up mod_php with apache2 as well. I know there are still some people out there that can't get it to work.

Oh, one question. Is PHP being moved to dev-lang instead of being in dev-php? That is onething I noticed with the overlay, but in portage, php is still in dev-php.

Thanks

----------

## mserms

Another little question: how do I get the MySQL PDO drivers installed with PHP 5.1 beta 1? I have mysql in my use flags, and do not have sqlite in my use flags, but only have the SQLite PDO drivers.

Any thoughts?

----------

## stuherbert

dev-lang/php will eventually replace the three packages dev-php/php, dev-php/php-cgi, and dev-php/mod_php.  It will replace them very soon for PHP 5, and eventually for PHP 4 as well.

PDO support will be added later this week.  This question has already been answered by my blog posts mentioned above.  Please make an effort to follow the blog posts, so that I don't spend all my time answering questions like this!

Thanks,

Stu

----------

## mserms

 *stuherbert wrote:*   

> PDO support will be added later this week.  This question has already been answered by my blog posts mentioned above.  Please make an effort to follow the blog posts, so that I don't spend all my time answering questions like this!

 

Stuart, I have been following the blog posts (with interest), although they have been inconsistent with the tarball recently. You mentioned that "ebuilds for pecl-pdo and its assorted drivers" will be added later, yet my PHP installation has PDO enabled for SQLite. Thanks for all your work on this, I really think it's looking like a great system - however, don't ask for people to test stuff and then get irritated when they do show an interest and need to ask questions.

----------

## andreask

```
andreas@test php-5.1.0b3 $ ./configure --help | grep -i pdo

  --disable-pdo           Disable PHP Data Objects support

  --with-pdo-dblib[=DIR]      Include PDO_DBLIB-DB support.  DIR is the FreeTDS home

  --with-pdo-firebird[=DIR] PDO: Firebird support.  DIR is the Firebird base

  --with-pdo-mysql[=DIR]    PDO: MySQL support. DIR is the MySQL base directory

  --with-pdo-oci[=DIR]      PDO: Oracle-OCI support. Default DIR is ORACLE_HOME.

                            You may also use --with-pdo-oci=instantclient,prefix,version to use

                            --with-pdo-oci=instantclient,/usr,10.1.0.3

  --with-pdo-odbc=flavour,dir

                            PDO: Support for 'flavour' ODBC driver.

                              --with-pdo-odbc=unixODBC

                              --with-pdo-odbc=generic,dir,libname,ldflags,cflags

                            named pdo_odbc.so

  --with-pdo-pgsql[=DIR]    PDO: PostgreSQL support.  DIR is the PostgreSQL base

  --without-pdo-sqlite      PDO: sqlite 3 support

```

PDO and PDO-SQLITE are enabled by default in PHP 5.1.

----------

## mserms

Ah, that's more like it! Thanks andreask.

----------

## Redeeman

why are this overlay needed? i run php5 perfectly fine with the ebuilds that is currently masked in portage

----------

## andreask

please have a look at Stuarts Blog and look at its archive to read posts like that: http://stu.gnqs.org/diary/gentoo.php/2005/07/11/radical_changes_for_php5_support

If you read GWN, you should have read: http://article.gmane.org/gmane.linux.gentoo.devel/30050

----------

## Redeeman

oh well.. when this gets into portage, i will upgrade, but untill then php5 works flawlessly as it is now

----------

## stuherbert

Try installing an existing PECL package, or try running a mixed PHP4 / PHP5 environment, and you'll quickly see why the existing dev-php/php and dev-php/mod_php ebuilds need replacing with a different solution.

Things are looking good that we'll be able to move the packages from the overlay into Portage over the weekend.

Best regards,

Stu

----------

## andreask

That's great news!

And also PHP 5.1.0 is not far away anymore, which looks very promising too: http://www.sebastian-bergmann.de/blog/archives/504-PHP-5.1-Performance.html (beside PDO, xmlReader...)  :Wink: 

----------

## Redeeman

well i am not interrested in running mixed php4/5, however pecl might be interresting..

i just hope this thing wont make the php5 support worse, since as for me, its working quite perfect..

anyway, when it gets merged into portage i will certainly try it out

----------

## jonasmattsson

This is probably a silly question, but i follow the guide and i cant get the apache to preprocess my php-file, firefox only offers me to download the file.  what to do?

----------

## StifflerStealth

First, make sure that you compiled dev-lang/php with the apache2 use flag.

Then, edit the file: /etc/conf.d/apache2

next change the line from:  *Quote:*   

> APACHE2_OPTS="-D DEFAULT_VHOST"

  to:  *Quote:*   

> APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5"

 

then type: 

```
/etc/init.d/apache2 restart
```

That is all I did to get it to work.

----------

## mserms

 *jonasmattsson wrote:*   

> This is probably a silly question, but i follow the guide and i cant get the apache to preprocess my php-file, firefox only offers me to download the file.  what to do?

 

I needed to upgrade apache to get the overlay to work, but something definitely went screwy with it. Seemed like the init script wasn't properly stopping apache, so I needed to "killall apache2" and then restart (using the init script) which seemed to sort it out. Not sure if that helps.

----------

## djcronos

I must say this is indeed an awesome tutorial, yet I'm still a little confused with a few things.  I plan on posting a separate topic, but I feel this needs to be mentioned in this topic as well (and possibly having this HOWTO updated as a result?)

On a side note, I'm still somewhat a novice when it comes to setting up PHP4/5 on a linux system, altho I am well experienced in getting it set up, anything beyond basic setup and editing of conf files is still a bit hazy, but I am eager to learn (and research more, if need be).

Our company wants me to use Komodo to collaborate with other developers.  I've successfully installed PHP5 using this howto, and running a test php script shows me I'm running PHP 5.1 flawlessly (so far).  I then installed Komodo, and when it searched for installed libraries, it only found Perl and Python.  I'm assuming two things here:

1) Since Perl and Python were found in /usr/bin and there is no sign of PHP anything in there, I need to make a symbolic link to point to the PHP5 directory

2) I have read that PHP5 comes with its own CLI and PHP5 for Apache was renamed php-cgi - is that true?

Also, I'm used to when emerging something that is CLI based, that I can easily just type in the name of the program from a CLI and hit tab to autocomplete the name (or bring up a list of programs that start with the command I typed) yet I see nothing for PHP.  How would a symlink that?  When I find the PHP5 cli, do I just make a symlink to /usr/bin?

I don't think I need help on the Komodo part, just knowing where this install puts PHP5.  I'm checking my sytem now, but figured I'd throw up this question while I look.  I'll give a heads up when I find out more.

Thanks guys.

----------

## andreask

 *djcronos wrote:*   

> I must say this is indeed an awesome tutorial, yet I'm still a little confused with a few things.  I plan on posting a separate topic, but I feel this needs to be mentioned in this topic as well (and possibly having this HOWTO updated as a result?)

 

perhaps look at the project page: http://svn.gnqs.org/projects/gentoo-php-overlay/

 *djcronos wrote:*   

> I've successfully installed PHP5 using this howto, and running a test php script shows me I'm running PHP 5.1 flawlessly (so far).

 

you run a test-script using mod_php or cli/cgi?

The cli and cgi binaries will be installed to:

```
/usr/lib/php[45]/bin/php

/usr/lib/php[45]/bin/php-cgi
```

So one of these files has to be symlinked, which could be done using the eselect module (from Stuarts overlay-directory). But AFAIK this has been improved so it's done automatically, if you install only one PHP-Version.

 *djcronos wrote:*   

> 1) Since Perl and Python were found in /usr/bin and there is no sign of PHP anything in there, I need to make a symbolic link to point to the PHP5 directory

 

correct.

 *djcronos wrote:*   

> 2) I have read that PHP5 comes with its own CLI and PHP5 for Apache was renamed php-cgi - is that true?

 

if you use the "apache[2]" USE-flag, you will get mod_php, which is installed as Apache-module. If you use "cgi" USE-flag, you will get a 

```
/usr/lib/php[45]/bin/php-cgi
```

binary. If you use the "cli" USE-flag, you will get

```
/usr/lib/php[45]/bin/php
```

 *djcronos wrote:*   

> Also, I'm used to when emerging something that is CLI based, that I can easily just type in the name of the program from a CLI and hit tab to autocomplete the name (or bring up a list of programs that start with the command I typed) yet I see nothing for PHP.  How would a symlink that?  When I find the PHP5 cli, do I just make a symlink to /usr/bin?

 

If you need only one version of php, try the latest overlay: http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/Downloads

If you need php4 and php5, portage cannot decide which one should be used, so you must use eselect to choose the a version or symlink it (in /usr/bin) as described above.

----------

## Styles

Well I need to get fruity installed for nagios and it req php5, but I'm running into one problem

```
checking for db4 major version... configure: error: Header contains different version
```

I have rebuilt db and tried again with the same error?

Anybody have any Ideas ?

----------

## llongi

Hi Styles.

That should not happen, I install it with db4 support fine. "db" support is activated by the "berkdb" USE flag.

Are you really sure that you installed a sys-libs/db package of the 4 series, since we support only db-4*?

Please try to reemerge the exact version of db first and then reemerge PHP5 (the one from the overlay).

```

emerge =sys-libs/db-4.2.52_p2

```

----------

## Styles

same thing ???

checking for db4 major version... configure: error: Header contains different version

----------

## llongi

Hi, ok, I can't reproduce the bug, so please give me more information, the following would be really helpful:

```

emerge -pv dev-lang/php

```

This will output the version and all the USE flags you're using to install PHP5.

```

emerge -Cpv sys-libs/db | grep selected

```

This will output all the installed versions of sys-libs/db on your system. (Be careful with this command, execute it exactly as it's here, copy&paste it, if you forget the "pv" after the "-C" it would remove the sys-libs/db package instead of simulating what would be done)

```

ls -lah /usr/include/db.h

```

This will output data on the mentioned file.

Just copy&paste the commands, execute them and copy&paste all the output back here. Thanks!

----------

## Styles

ya the only db is 4.2 strange??? anyway I'm doing a 

```
emerge --update --deep --newuse world
```

 (just started so it's going to take a bit) with some new use flags, then I will try again.

I would rebuild the whole box but Opensims was a royal pain in the butt to get up and running.

----------

## tessmonsta

Thanks for the tutorial! It really helped with my php5 install.

But now I have a bit of a problem:

```
Fatal error: Call to undefined function session_start() in /home/deninet/public_html/index.php on line 6
```

Appearently, the session extension has been disabled. After a few searches, it seems that I should add "session" to package.use

I'm just guessing, of course.  :Confused: 

----------

## nautiazn85

When can we expect PHP5 to be officially supported in portage? I'm waiting for that day before I install (it would be nice to install on my lappie as a testbed).

----------

## llongi

 *tessmonsta wrote:*   

> 
> 
> Appearently, the session extension has been disabled. After a few searches, it seems that I should add "session" to package.use
> 
> I'm just guessing, of course. 

 

This is correct. The session extension now depends on the setting of the "session" USE flag. We made it possible to select/deselect almost anything from both PHP4 and PHP5. When the new Ebuilds will go into Portage we'll update the default profiles so that important flags that practically everyone wants like "session", "sysvipc", and others that are normally in a default PHP install will be automatically activated, so you don't have to worry too much that a simple install of PHP will give you a too stripped-down version of it. Of course you can then, if you don't need something, just disable it.  :Smile: 

@ nautiazn85: We're currently going through a number of little bugs and updating corresponding, php-related Ebuilds in our overlay, after that's done we'll get the new Ebuilds into Portage, I daresay another week at least will be needed, but I'm not sure, that depends, if we find other problems we'll have to fix them and there are some things on our TODO list that need to be finished first.  :Smile: 

----------

## Plouj

It was rather unclear to me wether I should emerge mod_php after following this howto. Before I did that I don't think my apache was loading the php module.

(I'm a noob, so I really don't know whats going on behind the scenes)

----------

## llongi

 *Plouj wrote:*   

> It was rather unclear to me wether I should emerge mod_php after following this howto. Before I did that I don't think my apache was loading the php module.
> 
> (I'm a noob, so I really don't know whats going on behind the scenes)

 

No, mod_php is already installed by dev-lang/php if you activate either the "apache" or the "apache2" USE flags (depending on what version of Apache you're going to use).

There now also is a new site about all this new PHP-Overlay with more documentation, newer releases of the overlay with new features and a bug-tracking system if you have questions or find problems while installing the new PHP-Overlay (please post only _bugs_ or enhancement wishes in the bug-tracker, for normal support like "how do I do this or that?" refer to the documentation, post in this forum post here or come ask in #gentoo-apache on irc.freenode.net, thanks!). The site is: http://svn.gnqs.org/projects/gentoo-php-overlay/

----------

## Boosty

Hi there,

As a user new to Gentoo (never really used a distro other than Slackware) I have a few questions on this overlay. But I'll start off with something I ran into today:

The link to the tarball on http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/Downloads refers to /~stuart/php-overlay.tar.gz while this should actually be /~stuart/php/php-overlay.tar.gz . The current link returns a 404.

After I found the correct URL I started going with the wiki-article on installing this overlay:

http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/InstallOverlay

To give you a good view of what I'm trying to do:

My goal is to install both php4-cgi and php5-cgi together with Apache 1.3.x and use suPHP 0.6.0 with these.

I found a suphp ebuild on bugs.gentoo.org that mentioned this overlay to get this done.

Q1: The article mentions the following:

 *Quote:*   

> 
> 
> ```
> USE="pdo" emerge dev-lang/php
> ```
> ...

 

"Don't forget to actually emerge php"?

But err, isn't the command that is mentioned before that line the way to emerge php?

Do you mean "do not forget to emerge apache."?

Q2: First time I emerged php4 and php5, I forgot to set the

```
ACCEPT_KEYWORDS="~amd64"
```

(it's a amd64, so no ~x86)

But both php4 and php5 emerged fine. What did I miss by not using this parameter?

I know that the keywords means that emerge can use ebuilds that aren't marked stable on amd64, but I believe that PHP5 was marked unstable. Why didn't emerge complain?

Q3: I replaced the

```
emerge dev-lang/php
```

by

```
emerge '=dev-lang/php-4*' '=dev-lang/php-5*'
```

because I want both.

In the example I see that this should emerge:

dev-libs/apr

dev-libs/apr-util

net-www/apache-2

dev-lang/php-5.1.0_beta-r3

But when I do my code, only php-4 and php-5 are installed without apache.

This isn't a problem; I can emerge apache seperately, but I'm curious: why didn't the dependecies show up here?

Hope someone could clarify these things for me. Thanks in advance for that.  :Wink: 

Don't worry if I messed things up; I'll start over on building after my questions are answered anyway  :Razz: 

----------

## llongi

 *Boosty wrote:*   

> Hi there,
> 
> As a user new to Gentoo (never really used a distro other than Slackware) I have a few questions on this overlay. But I'll start off with something I ran into today:
> 
> The link to the tarball on http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/Downloads refers to /~stuart/php-overlay.tar.gz while this should actually be /~stuart/php/php-overlay.tar.gz . The current link returns a 404.c

 

Welcome to Gentoo, and thanks for reporting this, was fixed now!

 *Boosty wrote:*   

> After I found the correct URL I started going with the wiki-article on installing this overlay:
> 
> http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/InstallOverlay
> 
> To give you a good view of what I'm trying to do:
> ...

 

Just for info, the suPHP Ebuild is also in the official Portage tree as far as I know now.

 *Boosty wrote:*   

> Q1: The article mentions the following:
> 
>  *Quote:*   
> 
> ```
> ...

 

Hmm that passage is not clear. I corrected it now in the docs. Thanks for pointing out.

 *Boosty wrote:*   

> Q2: First time I emerged php4 and php5, I forgot to set the
> 
> ```
> ACCEPT_KEYWORDS="~amd64"
> ```
> ...

 

Well, unless you run your whole machine as ACCEPT_KEYWORDS="~amd64" in /etc/make.conf or if you first added "dev-lang/php" to /etc/portage/package.keywords, then emerge should have complained. If you did one of the two aforementioned things, then it's normal and expected that emerge will permit you to install dev-lang/php without problems.

 *Boosty wrote:*   

> Q3: I replaced the
> 
> ```
> emerge dev-lang/php
> ```
> ...

 

Hmm I just tested that with adding "-e" (--emptytree) to emerge, so that it simulates an emerge with the dependencies that would be installed if nothing else was installed on the system, and Apache was part of this. Did you add "net-www/apache" to /etc/portage/package.keywords? Are you sure you set the "apache2" USE flag while emerging your PHP? If yes, and if Apache isn't already installed, it should pull it in and install it before PHP...

 *Boosty wrote:*   

> Hope someone could clarify these things for me. Thanks in advance for that. 
> 
> Don't worry if I messed things up; I'll start over on building after my questions are answered anyway 

 

No problem.  :Smile:  We appreciate testers that do frequent rebuilds, they spot more bugs.  :Razz: 

----------

## StifflerStealth

Apache 2 is marked stable in the portage tree, so type as root:  *Quote:*   

> $ emerge info

 and look at the use flag section. The flags should be in alphabetical order and look for the apache and apache2 flags. If you do not see apache, but you see apache2, you need to edit the file /etc/make.conf. In that file, find the USE="..." part and look for the apache2 flag. You need to change that from apache2 to apache. Then save and exit. Then type:  *Quote:*   

> emerge -uD world --newuse -p

  to see if any of the packages need to be updated.

Also, since apache2 is stable and it seems like you don't intend to use it, can type this as root:  *Quote:*   

> echo net-www/apache-2* >> /etc/portage/package.mask

  That will make sure that all apache 2 is now masked. Nothing should depend on it at this point. Also, you made to unmerge Apache2 before doing this, if it is installed.

EDIT: Oh, when I type your code, I get this:  *Quote:*   

> emerge '=dev-php/php-4*' '=dev-php/php-5*' -p
> 
> These are the packages that I would merge, in order:
> 
> Calculating dependencies ...done!
> ...

  It works, but there is a blocker and I have no idea where that comes from. :S NOTE: I cheated a little with the overlay. Since some packages are hard linked to depend on dev-php/php I copied all the files from dev-lang to dev-php and changed the ebuild to -r2 to override the version in portage which is -r1.

----------

## Boosty

 *CHTEKK wrote:*   

> Just for info, the suPHP Ebuild is also in the official Portage tree as far as I know now.

 

Ah, my tree was last sync'ed on august 6. And the suPHP ebuild was added... august 6, just after I sync'ed  :Wink: 

Thanks for mentioning!

 *CHTEKK wrote:*   

> Well, unless you run your whole machine as ACCEPT_KEYWORDS="~amd64" in /etc/make.conf or if you first added "dev-lang/php" to /etc/portage/package.keywords, then emerge should have complained. If you did one of the two aforementioned things, then it's normal and expected that emerge will permit you to install dev-lang/php without problems.

 

That explains.

I did list dev-lang/php in package.keywords, but I was under the impression that both actions were required for this to work out. Reading this part of the wiki again I can see where I went wrong.

Why not use

```
ACCEPT_KEYWORDS=~amd64 emerge <package> -p
```

just as you on the USE="pdo"? (suggested by a friend of mine)

 *CHTEKK wrote:*   

>  *Boosty wrote:*   But when I do my code, only php-4 and php-5 are installed without apache.
> 
> This isn't a problem; I can emerge apache seperately, but I'm curious: why didn't the dependecies show up here? 
> 
> Hmm I just tested that with adding "-e" (--emptytree) to emerge, so that it simulates an emerge with the dependencies that would be installed if nothing else was installed on the system, and Apache was part of this. Did you add "net-www/apache" to /etc/portage/package.keywords? Are you sure you set the "apache2" USE flag while emerging your PHP? If yes, and if Apache isn't already installed, it should pull it in and install it before PHP...

 

I didn't add net-www/apache to /etc/portage/package.keywords , or use the apache2 USE flag while emerging.

But I think I already discovered the problem in the USE flag in /etc/make.conf , see below.

 *Quote:*   

> No problem.  We appreciate testers that do frequent rebuilds, they spot more bugs. 

 

Thanks for your help, I'll try again tomorrow.

 *StifflerStealth wrote:*   

> If you do not see apache, but you see apache2, you need to edit the file /etc/make.conf. In that file, find the USE="..." part and look for the apache2 flag. You need to change that from apache2 to apache.

 

Ah thanks. I did have "-apache2" in there, but no "apache" USE flag.

I'll see to it that my packages are updated to reflect the new USE flags.

 *StifflerStealth wrote:*   

> Also, since apache2 is stable and it seems like you don't intend to use it, can type this as root:  *Quote:*   echo net-www/apache-2* >> /etc/portage/package.mask  That will make sure that all apache 2 is now masked. Nothing should depend on it at this point. Also, you made to unmerge Apache2 before doing this, if it is installed.

 

I had this set up slightly different:

/etc/portage/package.mask:

```
>=net-www/apache-2
```

I'll research the difference between your version and mine  :Wink: 

 *StifflerStealth wrote:*   

> EDIT: Oh, when I type your code, I get this:  *Quote:*   emerge '=dev-php/php-4*' '=dev-php/php-5*' -p
> 
> These are the packages that I would merge, in order:
> 
> Calculating dependencies ...done!
> ...

 

When I was messing around with the overlay, I had a message like this (different version for the blocker) and I had to do a emerge -C php again to get rid of php, I'm not sure why though. I did check the emerge.log which indicated that I did do a emerge -C php before actually starting with the overlay.

Perhaps something like this is the case on your machine as well? (oh well, if it works, then why change it  :Wink: )

----------

## StifflerStealth

 *Boosty wrote:*   

>  *StifflerStealth wrote:*   Also, since apache2 is stable and it seems like you don't intend to use it, can type this as root:  *Quote:*   echo net-www/apache-2* >> /etc/portage/package.mask  That will make sure that all apache 2 is now masked. Nothing should depend on it at this point. Also, you made to unmerge Apache2 before doing this, if it is installed. 
> 
> I had this set up slightly different:
> 
> /etc/portage/package.mask:
> ...

 

I'll research the difference between your version and mine  :Wink: [/quote] Well, I forgot the '=' in front, so it should have been: =net-www/apache-2*

 :Embarassed: 

There really is no difference between the two. The way I have it means that all packages with 2.x as a version, which means greater than or equal to version 2.  :Wink:  However, you can change mine to =net-www/apache-2.0* which will mask all version 2.0.x, so if version 2.1 ever comes out and you want to try that, it won't be masked.

Like I have in my package.unmask: =dev-php/php-5.0.4*

This way I do not get the 5.1 betas of php and only the 'stable' release.

Cheers.

----------

## Boosty

[edit]

Sorry, forgot that this wasn't the support forum. Perhaps my posts and the answers should be split to a new topic. If anyone can confirm the anomalies I report in this post, I'd be happy to make a bugreport.

[/edit]

I just emerged php4, php5 and apache 1.3 again. This time everything went exactly as described on the wiki page. That also includes using the eselect module to make the symlink.

The reason that apache didn't come with the emerge was (as mentioned by CHTEKK) because I didn't have the apache USE flag in /etc/portage/package.keywords . I only had the cgi USE flag (no cli, apache or apache2), because I didn't need the modules and thought they would conflict when emerging.

The configuration ended up in /etc/php/apache1-php4/ and I assume this is right when modules are build next to cgi binaries.

Here's a diff of the configurations (apache 1.3 had php4 installed as a module before it was unmerged to use the overlay, that's why there was a config already):

```
cingulate php-overlay # diff ._cfg0000_php.ini /etc/php/apache1-php4/php.ini

411c411,412

< include_path = ".:/usr/share/php"

---

> ;include_path = ".:/php/includes"

> include_path = ".:/usr/lib/php"

414c415

< include_path = ".:/usr/share/php"

---

> ;include_path = ".;c:\php\includes"

428c429

< extension_dir = /usr/lib64/php4/lib/php/extensions/no-debug-non-zts-20020429

---

> extension_dir = /usr/lib64/php/extensions/no-debug-non-zts-20020429

496a498,499

> ; allow_url_fopen = On

> ; Closed for security - <robbat2@gentoo.org>

535c538

< ; extension_dir directive above.

---

> ; extension_dir = /usr/lib64/php/extensions/no-debug-non-zts-20020429

cingulate php-overlay #
```

I noticed that include_path is changed from ".:/usr/lib/php" which doesn't exist on my system, to ".:/usr/share/php" which doesn't exist either. I do have /usr/lib/php[45] directories. Did something go wrong here, or is the "." path enough for cgi-php to find it's libs?

Also note that ".:/usr/share/php" is uncommented for both UNIX as Windows in the new config, while Windows was commented in the old one.

----------

## llongi

 *Boosty wrote:*   

> I noticed that include_path is changed from ".:/usr/lib/php" which doesn't exist on my system, to ".:/usr/share/php" which doesn't exist either. I do have /usr/lib/php[45] directories. Did something go wrong here, or is the "." path enough for cgi-php to find it's libs?
> 
> Also note that ".:/usr/share/php" is uncommented for both UNIX as Windows in the new config, while Windows was commented in the old one.

 

Yes this is correct, the configuration underwent some major changes. The include_path is correct with ".:/usr/share/php", since the first . means "search the libs I need in the current directory where I (script) am being executed", and /usr/share/php points to the location where PEAR packages and so on would be installed. This directory is created and populated with stuff if you activate the "pear" USE flag, and/or if you emerge dev-php/PEAR-PEAR (please update to the latest overlay for this, a updated dependency needed to be put in for this to work). The /usr/lib/php[45] directories are totally correct, that's where the binaries and the modules from PHP get installed, the .php Libraries go into /usr/share/php like mentioned if you emerge PEAR packages for example. Also the fact that the include_path gets set two times to the exactly same thing is no problem, it all works the same and is normal as far as I can see because of the "sed" statement in the new Eclasses. No need to worry about that.  :Wink: 

----------

## Boosty

Alright.

I got my situation to work (mod_php4 + suPHP using php4 and php5) after altering the suPHP ebuild to work with apache 1.3. I'm experiencing a small problem which I hope to fix through compiling PHP with --enable-discard-path. I see no USE flags for this, is it a problem to use this options on this ebuild?

----------

## llongi

 *Boosty wrote:*   

> I'm experiencing a small problem which I hope to fix through compiling PHP with --enable-discard-path. I see no USE flags for this, is it a problem to use this options on this ebuild?

 

Hi, there was no such USE flag because no one of us thought about that configure-switch.  :Smile:  I just added the USE flag "discard-path" to the PHP Ebuilds that toggles "--enable-discard-path". The updated Ebuilds are available in the SVN repository or in the next hourly tarball. Have fun and thanks for reporting this, CHTEKK.

EDIT: Though I'm not sure this new option will solve your suPHP problems, I have heard of other people who have it running without this. The USE flag is just provided as another option, if it doesn't work with that option set, it probably isn't the fault of PHP but of some suPHP/Apache related configuration.  :Smile: 

----------

## Boosty

 *CHTEKK wrote:*   

> Hi, there was no such USE flag because no one of us thought about that configure-switch.  I just added the USE flag "discard-path" to the PHP Ebuilds that toggles "--enable-discard-path". The updated Ebuilds are available in the SVN repository or in the next hourly tarball. Have fun and thanks for reporting this, CHTEKK.

 

Thanks for adding this. I just used the hourly overlay to remerge PHP (was using the official tarball before) and as the looks of it, it worked perfectly.

 *CHTEKK wrote:*   

> EDIT: Though I'm not sure this new option will solve your suPHP problems, I have heard of other people who have it running without this. The USE flag is just provided as another option, if it doesn't work with that option set, it probably isn't the fault of PHP but of some suPHP/Apache related configuration. 

 

The problem was gone after using the discard-path flag. I'm not sure if it's suPHP related, but it had to do with the way CGI handled PATH_INFO and PATH_TRANSLATED when using multiviews (it threw a "No input file specified.' message when attempting multiviews, which is a quite 'populair' error when using CGI). I believe Apache2 has a 'AcceptPathInfo On' directive to fix this, but apache1 doesn't.

I confirmed that it was the discard-path that made the difference by unmerging the PHP installed by the new overlay, and using the old overlay again.

Although everything looks fine, there are a few things I noticed while emerging, I'll leave it up to you guys to decide wether it's worth looking at  :Wink: 

I've included a single line before and after every error/warning to show it's position when compiling.

While configuring php-4.4.0 (CGI):

```
* Rebuilding configure script

configure.in:150: warning: AC_PROG_LEX invoked multiple times

autoconf/programs.m4:438: AC_DECL_YYTEXT is expanded from...

configure.in:150: the top level

>>> Source unpacked.
```

php-4.4.0 (CGI and apache1mod)

```
 *   Enabling ipv6

/usr/local/portage/eclass/php4-sapi-r1.eclass: line 314: java-config: command not found

 *   Disabling java

 *   Enabling jpeg-dir
```

php-5.0rc1 (CGI)

```
 * Rebuilding configure script

configure.in:141: warning: AC_PROG_LEX invoked multiple times

autoconf/programs.m4:438: AC_DECL_YYTEXT is expanded from...

aclocal.m4:2016: PHP_PROG_LEX is expanded from...

configure.in:141: the top level

>>> Source unpacked.
```

php-5.0rc1 (CGI and apache1mod)

```
checking for re2c... no

configure: WARNING: You will need re2c 0.98 or later if you want to regenerate PHP parsers.

checking for gawk... gawk
```

I was using the following USE flags:

 *Quote:*   

> =dev-lang/php-4* -* apache bcmath bzip2 calendar cgi ctype crypt discard-path force-cgi-redirect ftp gif exif gd imagemagick imap innodb ipv6 jpeg memlimit mime mysql nls pdflib perl png posix session simplexml ssl sysvipc threads tiff truetype xml xml2 xsl zlib

 

(and same flags for php5)

----------

## llongi

 *Boosty wrote:*   

> 
> 
> Thanks for adding this. I just used the hourly overlay to remerge PHP (was using the official tarball before) and as the looks of it, it worked perfectly.
> 
> 

 

Good to hear this.

 *Boosty wrote:*   

> 
> 
> The problem was gone after using the discard-path flag. I'm not sure if it's suPHP related, but it had to do with the way CGI handled PATH_INFO and PATH_TRANSLATED when using multiviews (it threw a "No input file specified.' message when attempting multiviews, which is a quite 'populair' error when using CGI). I believe Apache2 has a 'AcceptPathInfo On' directive to fix this, but apache1 doesn't.
> 
> I confirmed that it was the discard-path that made the difference by unmerging the PHP installed by the new overlay, and using the old overlay again.
> ...

 

Ok thanks for the checking this.  :Smile:  I never used MultiViews in Apache 1or 2, and I neither use much suPHP, tried it some time ago, but atm I use suEXEC+mod_fastcgi+PHP-cgi to serve .php pages.

 *Boosty wrote:*   

> 
> 
> While configuring php-4.4.0 (CGI):
> 
> ```
> ...

 

This is normal afaik, until only warnings show up there is nothing to fear, if it would crash or throw a fatal error, then we'd have a problem, but that never happened.

 *Boosty wrote:*   

> 
> 
> php-4.4.0 (CGI and apache1mod)
> 
> ```
> ...

 

Ok, this was indeed a bug, or better a logic error in the php4-eclass.  :Smile:  Fixed this now in the Overlay. Thanks for reporting this!

 *Boosty wrote:*   

> 
> 
> php-5.0rc1 (CGI)
> 
> ```
> ...

 

This is normal afaik, until only warnings show up there is nothing to fear, if it would crash or throw a fatal error, then we'd have a problem, but that never happened.

 *Boosty wrote:*   

> 
> 
> php-5.0rc1 (CGI and apache1mod)
> 
> ```
> ...

 

This is normal afaik, until only warnings show up there is nothing to fear, if it would crash or throw a fatal error, then we'd have a problem, but that never happened. re2c is used afaik when regenerating PHP parsers, like it states there, but is not _needed_ to compile PHP, not how we do it anyway. If it would crash and throw a "Error: re2c is required blabla" then we'd have a problem, but it's only a warning about an option we don't even use and that is not needed.

Thank you again for reporting all of this and testing under Apache1, afaik no one ever did that since we all run Apache2. Heh, now we know it also works with Apache1! Thanks for your efforts, CHTEKK.

----------

## Boosty

 *CHTEKK wrote:*   

>  *Boosty wrote:*   
> 
> Thanks for adding this. I just used the hourly overlay to remerge PHP (was using the official tarball before) and as the looks of it, it worked perfectly.
> 
>  
> ...

 

Sorry, I was mistaken.

The emerge did go well, but I managed to break something on my running configuration. I think I didn't notice it first because I forgot to restart apache directly afterwards.

After doing some tests I found out that I didn't have the PCRE USE flag set, thus preventing PCRE from being compiled. This caused one of our websites to stop functioning.

Strangely, the official overlay didn't have this problem (I confirmed this) althought I didn't have the PCRE flag set there either. I can't isolate the problem by searching though the ebuilds and eselects. Looking at the code, not setting the PCRE USE flag should have caused problems with the official overlay as well.

 *CHTEKK wrote:*   

> Ok thanks for the checking this.  I never used MultiViews in Apache 1or 2, and I neither use much suPHP, tried it some time ago, but atm I use suEXEC+mod_fastcgi+PHP-cgi to serve .php pages.

 

Which is a good solution, if you aren't on a multi-user system or if you trust everyone  :Wink: 

 *CHTEKK wrote:*   

> Ok, this was indeed a bug, or better a logic error in the php4-eclass.  Fixed this now in the Overlay. Thanks for reporting this!

 

No problem.

 *CHTEKK wrote:*   

> Thank you again for reporting all of this and testing under Apache1, afaik no one ever did that since we all run Apache2. Heh, now we know it also works with Apache1! Thanks for your efforts, CHTEKK.

 

I will continue testing until the machine goes into production state. As far as I can tell the builds are fine for Apache1, if you get your USE flags right, that is.

----------

## llongi

 *Boosty wrote:*   

> 
> 
> After doing some tests I found out that I didn't have the PCRE USE flag set, thus preventing PCRE from being compiled. This caused one of our websites to stop functioning.
> 
> Strangely, the official overlay didn't have this problem (I confirmed this) althought I didn't have the PCRE flag set there either. I can't isolate the problem by searching though the ebuilds and eselects. Looking at the code, not setting the PCRE USE flag should have caused problems with the official overlay as well.
> ...

 

This is correct. I found yesterday evening a typo in the function that enables/disables the PCRE regex, so it made no difference if you had the USE flag on or off, they were _always_ on, that wasn't acceptable for people or embedded systems where you need to disable everything that you can. So the typo was fixed and now the "pcre" USE flag does what it should do: enable/disable PCRE regex support.  :Smile: 

The "official" Overlay tarball is old now, over a week, it misses _many_ important fixes that are in the SVN repository or in the hourly tarball, wich is much more up-to-date, stable and featureful than the "official" tarball. What will go next week into official Portage tree is the SVN repository. So I atm recommend using the hourly tarball, or even better if possible, the SVN repository directly.

 *Boosty wrote:*   

> 
> 
> Which is a good solution, if you aren't on a multi-user system or if you trust everyone 
> 
> 

 

Why? I solved it that thanks to suEXEC the PHP-cgi runs as the user of the file, and also each user has his own php.ini where I define customized open_basedir, tmp_path and other settings. It's like suPHP in that aspect, imho just faster (at least version 0.5.X of suPHP was relatively slow since it always needed to load the PHP-cgi binary, compared to mod_fastcgi that has always some php-cgi-processes "on hold").

 *Boosty wrote:*   

> 
> 
> I will continue testing until the machine goes into production state. As far as I can tell the builds are fine for Apache1.
> 
> 

 

Ok thanks, this helps us a lot.  :Smile:  Thanks again, have a nice day, CHTEKK.

----------

## Boosty

 *CHTEKK wrote:*   

> This is correct. I found yesterday evening a typo in the function that enables/disables the PCRE regex, so it made no difference if you had the USE flag on or off, they were _always_ on, that wasn't acceptable for people or embedded systems where you need to disable everything that you can. So the typo was fixed and now the "pcre" USE flag does what it should do: enable/disable PCRE regex support. 

 

Aha, good to have it fixed and now I know what the problem was exactly.  :Smile: 

 *CHTEKK wrote:*   

> Why? I solved it that thanks to suEXEC the PHP-cgi runs as the user of the file, and also each user has his own php.ini where I define customized open_basedir, tmp_path and other settings. It's like suPHP in that aspect, imho just faster (at least version 0.5.X of suPHP was relatively slow since it always needed to load the PHP-cgi binary, compared to mod_fastcgi that has always some php-cgi-processes "on hold").

 

I'll take back my last statement; I always was under the impression suPHP offered a slightly different approach to it's security making it more appropriate for webhosting services.

But I do believe suExec has a few drawbacks that makes it less managable on servers with a lot of vhosts, and it's configuration prone to small errors. CGI normally already confuses me (I can get it work, but I don't have a clue what I've done afterwards) and I'd like a more transparent setup with suPHP.

In addition, I believe that suExec normally needs a separate binary for every user and it needs extra fixes to make PHP scripts run without #!/path/to/phpcgi in the head.

Now, if the suPHP build could be fixed to work with apache1 out of the box, my configuration is as good as complete and consistent  :Smile:  If we reach a point where suPHP gets to slow, I can still consider using suExec.

Oh fyi; all testing is done on a amd64 dual-opteron system.

----------

## piercey

Hey guys,

Has anything been sorted out yet to get the mysql pdo extension (and others) loaded? All I can seem to get is the sqlite driver :\

----------

## ddd

 *ScriptBlue wrote:*   

> 
> 
> Add the following line to make.conf and promptly remove it after installing PHP5
> 
> ```
> ...

 

I have removed it, but now it wants to install old version?

How to fix it?

```
# /usr/bin/emerge -upv world

These are the packages that I would merge, in order:

Calculating world dependencies ...done!

[blocks B     ] dev-libs/apr-util (is blocking net-www/apache-2.0.54-r9)

[blocks B     ] dev-libs/apr (is blocking net-www/apache-2.0.54-r9)

[ebuild     UD] net-www/apache-2.0.54-r9 [2.0.54-r14] +berkdb -doc +gdbm +ipv6 -ldap (-selinux) +ssl -static -threads 33 kB 

Total size of downloads: 33 kB
```

[/quote]

----------

## branana

By following this HOWTO, I can confirm that it indeed does not process any .php files. ie, the mod_php is NOT installed even by using USE="apache2" flag, (i skipped the cgi and cli) parts.

```

LoadModule php5_module modules/libphp5.so

AddType applications/x-httpd-php .php

```

Indeed work and having it in httpd.conf does not generate an error.

Adding

```

-D PHP5

```

to the APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D USERDIR"

line in /etc/conf.d/apache2

does generate a warning when using /etc/init.d/apache2 start that says

php5 module is already started

To those expecting this to replace mod_php: it does not work. Requesting *.php will only A) display it as the source code, B) prompt you to download the *.php file.

----------

## ScriptBlue

Yes it is an replacement for mod_php, it is a module. I'd really appreciate if you would not show your imcompetance off here, and scare people from using PHP5. If you do not believe me http://www.scriptblue.com/phpinfo.php

Use AddHandler

----------

## psylence

Working great here, tho the fastbuild flag hosed it, had to build w/o.

----------

## ralscha

Hi

Three weeks ago I installed PHP 5.1 on a 2005.0 without any problems following the description from ScriptBlue.

Today i tried the same on a 2005.1 system and get this message:

```
emerge -p dev-lang/php           

These are the packages that I would merge, in order:

Calculating dependencies   

!!! All ebuilds that could satisfy "dev-lang/php" have been masked.

!!! One of the following masked packages is required to complete your request:

- dev-lang/php-4.4.0 (masked by: missing keyword)

- dev-lang/php-5.1.0_rc1 (masked by: missing keyword)
```

Now I'm a bit lost. I already tried different entries in package.keywords and package.unmask but nothing works. 

Has anybody an idea what i could do.

----------

## DNAspark99

I didn't follow this howto AT ALL, lol, but had no problems just emerging the packages that are currently available in portage, no overlay needed (not too sure if this means this is 'broken' or not, but it works for me - altough I am using apache-1.3 here, so if you want apache2 just lose the apache stuff from the following configs), all I had to do was 'emerge apache mod_php', and edit apache.conf to add the php config stuff (AddType)

/etc/portage/package.keywords :

```
 

#PHP5 (5.1)

>=dev-php/php-5.0.0 ~x86

>=dev-php/mod_php-5.0.0 ~x86

dev-php/PEAR-PEAR ~x86

#mysql 4.1

>=dev-db/mysql-4.1 ~x86

>=dev-perl/DBD-mysql-2.9004 ~x86

#apache-1.3 stuff:

>=net-www/apache-1.3

net-www/gentoo-webroot-default ~x86

net-www/mod_ssl ~x86
```

/etc/portage/package.unmask :

```
dev-db/mysql

dev-perl/DBD-mysql

>=dev-php/mod_php-5.0

>=dev-php/php-5.0

dev-php/PEAR-PEAR
```

/etc/portage/package.mask :

```
>=net-www/apache-2.0
```

----------

## ralscha

Found the solution. I forgot to add  ~overlay in ACCEPT_KEYWORDS

Calculating dependencies   

!!! All ebuilds that could satisfy "dev-lang/php" have been masked.

!!! One of the following masked packages is required to complete your request:

- dev-lang/php-4.4.0 (masked by: missing keyword)

- dev-lang/php-5.1.0_rc1 (masked by: missing keyword)[/code]

----------

## ragarwal

If I try to add "~overlay" in ACCEPT_KEYWORDS, emerge gives me a warning about ~overlay is not an acceptable keyword, but is ready to proceed anyway.

Should I just ignore this warning and go ahead with with php installtion?  Also, how in the world would I now install mod_php ???  F F F F F

It is annoying that the HOWTO dosen't even mention this ~overlay for ACCEPT_KEYWORDS thing.  No help in Gentoo forums about mod_php either.  I am starting to wonder if Gentoo is just a testbed for people who like to see compiler messages scroll by.

All I really want is to run vpopmail with a decent interface (horde/IMP).. and php5 situation is really got me frustrated.  I hope I don't have to go back to a DeadRat installtion  :Sad:  ... That would suck.  I was getting addicted to this Gentoo beer thingy...  :Sad: 

 *ralscha wrote:*   

> Found the solution. I forgot to add  ~overlay in ACCEPT_KEYWORDS
> 
> Calculating dependencies   
> 
> !!! All ebuilds that could satisfy "dev-lang/php" have been masked.
> ...

 

----------

## DNAspark99

 *ragarwal wrote:*   

> If I try to add "~overlay" in ACCEPT_KEYWORDS, emerge gives me a warning about ~overlay is not an acceptable keyword, but is ready to proceed anyway.
> 
> Should I just ignore this warning and go ahead with with php installtion?  Also, how in the world would I now install mod_php ???  F F F F F
> 
> It is annoying that the HOWTO dosen't even mention this ~overlay for ACCEPT_KEYWORDS thing.  No help in Gentoo forums about mod_php either.  I am starting to wonder if Gentoo is just a testbed for people who like to see compiler messages scroll by.
> ...

 

try my method posted above. ignore the overlay, and the rest of this 'howto'. just use those /etc/portage/package.* configs, works for me, easy php5, no problems

----------

## Rukie

Instead of installing apache,l php, mysql all seperate.... I find it much easier to just use http://www.xampp.org :p Takes 2 min to install and comes with a whole bunch of extensions  :Very Happy: 

But thats just me.... 

P.S. Xampp (Lampp for linux) comes with both php4 and php5 that can be switched with just a couple keystrokes for php5 testing and php4 stability (and older programs!)

(Even tho its not in portage... its extremely easy to setup)

----------

## Skippo82

What i did:

add apache2, php, php4 to /etc/make.conf

1. emerge apache2 --> make the configuration with webmin(change module in webmin to apache2), because its easy

2. emerge php

3. emerge mod_php

4. edit the file /etc/apache2/conf/apache2.conf --> add 2 lines: LoadModule php4_mod extramodules/libphp4.so

                                                                                             AddType application/x-httpd-php .php .php4

5. edit the file /etc/conf.d/apache2 --> put "-D PHP4" option to the line APACHE_OPTS

6. restart with /etc/init.d/apache2 restart

7. write index.htm in my apache root directory, connect to my server over dyndns.org and it worked fine.

thought, this was very easy, built up my own apache-server in about 1 day (with emerging and breaks)

----------

## Redeeman

has this been merged into portage yet? if not, when will it be?

----------

## nautiazn85

I was reading one of the developer blogs and it should be a part of portage already. However don't quote me.

I really wanted to prove everybody wrong and build a strong stable server out of a gentoo box... but it's difficult to build a gentoo webserver when applications like php5 take forever to appear in Portage.

Right now I'm looking at Debian and FreeBSD for my serer. However I'm looking more at Debian since it's a Christian Company... and I dunno how well the "beastie" logo will fare for us. If only FreeBSD would change their mascot... I really like the OS on a server environment too.

----------

## andreask

latest GWN -  Simultaneous PHP4/PHP5 support in Gentoo

latest Posting on gentoo.dev: Packages for mixed PHP4/PHP5 environment added to Portage

planet.gentoo.org: PHP Overlay Packages Now In Portage

Documentation from Gentoo PHP project page:

Upgrade HOWTO: http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/HowToUpgrade

FAQ: http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/CommonQuestions

Retiring the old packages: http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/RetiringTheOldPackages

----------

## andreask

 *Rukie wrote:*   

> Instead of installing apache,l php, mysql all seperate.... I find it much easier to just use http://www.xampp.org :p Takes 2 min to install and comes with a whole bunch of extensions 
> 
> Xampp (Lampp for linux) comes with both php4 and php5 that can be switched with just a couple keystrokes for php5 testing and php4 stability (and older programs!)
> 
> (Even tho its not in portage... its extremely easy to setup)

 

Please note that XAMPP is not meant for production use and should really only be used in a development environment:

 *XAMPP README wrote:*   

> As mentioned before, XAMPP is not meant for production use but only for developers in a development environment. The way XAMPP is configured is to be open as possible and allowing the developer anything he/she wants. For development environments this is great but in a production environment it could be fatal.

 

http://www.apachefriends.org/en/xampp-linux.html#381

----------

## ddd

I have installed PHP5 by this guide, and all worked fine for a 1 month.

But now, I can update my syste:

```

# /usr/bin/emerge -upv world

These are the packages that I would merge, in order:

Calculating world dependencies   

!!! All ebuilds that could satisfy "dev-lang/php" have been masked.

!!! One of the following masked packages is required to complete your request:

- dev-lang/php-4.4.0 (masked by: package.mask)

# Stuart Herbert <stuart@gentoo.org> (1 Sep 2005)

# Masked until all packages from the overlay are in

- dev-lang/php-5.0.4 (masked by: package.mask)

- dev-lang/php-5.1.0_beta-r3 (masked by: package.mask)

For more information, see MASKED PACKAGES section in the emerge man page or 

section 2.2 "Software Availability" in the Gentoo Handbook.

!!!    (dependency required by "dev-php/PEAR-PEAR-1.3.6" [ebuild])

!!! Problem with ebuild dev-php/PEAR-PEAR-1.3.6

!!! Possibly a DEPEND/*DEPEND problem.

!!! Depgraph creation failed.

```

----------

## Redeeman

 *nautiazn85 wrote:*   

> I was reading one of the developer blogs and it should be a part of portage already. However don't quote me.
> 
> I really wanted to prove everybody wrong and build a strong stable server out of a gentoo box... but it's difficult to build a gentoo webserver when applications like php5 take forever to appear in Portage.
> 
> Right now I'm looking at Debian and FreeBSD for my serer. However I'm looking more at Debian since it's a Christian Company... and I dunno how well the "beastie" logo will fare for us. If only FreeBSD would change their mascot... I really like the OS on a server environment too.

 

php5 has been in portage forever.

just not this new thing, where you should be able to have php4 and php5 installed the same time..

personally, i just want php5, and not php4

----------

## soulwarrior

 *ddd wrote:*   

> I have installed PHP5 by this guide, and all worked fine for a 1 month.
> 
> But now, I can update my syste:
> 
> 

 

The overlay for PHP is no longer needed, as dev-lang/php now appeared in the official portage tree.

----------

## Redeeman

i just installed the new php package yesterday, instead of the now removed php5 package, it works fine,

----------

## imotlaw

I could be waaaaay off base here, but the problem branana was describing (Sun, Aug. 21st, this thread) is the exact same one I had; of course, the problem was that (being a n00b and never having administered my own apache server before) I forgot that apache isn't going to read just any php file I request (for example, by default, if I send a browser to "file:///home/walter/Php/hello.php" it's going to say something akin to "No such number, no such zone"). 

What you have to do (and I know that basically everyone else who's reading this already knows this, it's just that branana was so, ummm, let's call it unfriendly, that his post didn't get a serious answer) is (1) figure out the directory from which apache is starting to look for files (on my system the default was /var/www/localhost/htdocs); (2) decide if you like that setting; (3) if you do, place any php files you want processed there, and if you don't, change the setting by adding "DocumentRoot /place/where/you/want/yourfiles" to your /etc/apache2/httpd.conf file, and place your php files in that directory.

So, in the unlikely event that branana is still reading, maybe that will work. If it doesn't, feel free to post your problem (along with relevant data and without the editorialzing) and we'll all keep trying. And maybe this will help some other novice like me who's never used apache before.

BTW, to the whole php herd, thanks for all the hard work and coping with the limited appreciation. We're all (well, most of us) gratetful.

----------

## tragor

Hi,

I am probably missing something here... But I followed the instructions up to 4) and have now a edited make.conf with 

```
ACCEPT_KEYWORDS="~x86"

```

and a /etc/portage/package.keywords with

```

dev-lang/php ~x86

```

and a /etc/portage/package.use with

```

dev-lang/php cli cgi apache2 sockets session sysvipc

```

When it comes to 5) I allways get:

```

Calculating dependencies

!!! All ebuilds that could satisfy "dev-lang/php" have been masked.

!!! One of the following masked packages is required to complete your request:

- dev-lang/php-4.4.0 (masked by: missing keyword)

- dev-lang/php-5.1.0_rc1 (masked by: missing keyword)

```

What have I done wrong?

Thanks in advance,

tragor

----------

## andreask

The packages are in portage now, try to follow the "Upgrading PHP" Guide.

----------

## Boosty

I just tried a fresh hourly version of the new overlay but I'm having some problems with PEAR.

A emerge -pv PEAR-PEAR (or when emerging something that has PEAR as a USE flag), I get:

```
[ebuild  N    ] dev-php/PEAR-PEAR-1.4.1  0 kB

[ebuild  N    ] dev-php/PEAR-Archive_Tar-1.3.1-r1  0 kB

[ebuild  N    ] dev-php/PEAR-Console_Getopt-1.2-r1  0 kB

[ebuild  N    ] dev-php/PEAR-XML_RPC-1.4.3  0 kB
```

Now, when I emerge, PEAR won't install because

```
Files listed in the manifest do not exist!
```

This is true, because the ebuild expects

PEAR-1.3.6 instead of 1.4.1, PEAR-XML_RPC-1.4.2 instead of 1.4.3, etc.

and only has digests for those files.

So; I masked PEAR-1.4.1, so emerge takes 1.3.6.

But when I mask PEAR-XML_RPC-1.4.3, emerge starts complaining.

package.mask:

```
>=dev-php/PEAR-PEAR-1.4.1

>=dev-php/PEAR-XML_RPC-1.4.3
```

emerge -pv PEAR-PEAR

```
!!! All ebuilds that could satisfy ">=dev-php/PEAR-XML_RPC-1.4.2" have been masked.

!!! One of the following masked packages is required to complete your request:

- dev-php/PEAR-XML_RPC-1.4.3 (masked by: package.mask)
```

Note that it sais that 1.4.2 is masked by 1.4.3.

I've tried unmasking 1.4.2 by putting it in package.unmask, but that didn't help.

What should I do about this?

----------

## llongi

Do not mask PEAR-XML_RPC, since that one is stable and in the Portage tree. Only mask >=dev-php/PEAR-PEAR-1.4.0 since it's the one from the overlay, and it's still highly experimental and Sebastian's working on it (in fact it's in the overlays /experimental category).

Best regards, CHTEKK.

----------

## robintw

Hi all,

I've followed the tutorial in the first post of this thread and have the following problem. If I try and access the file test.php in my webservers root directory (http://robinwilson.homelinux.com/test.php if you want to try it) it works fine and gives me the output of phpinfo(). When I try to access http://robinwilson.homelinux.com/blog/ however, or http://robinwilson.homelinux.com/ - both of which have index.php's it fails and firefox asks to download the php file.

Does anyone have any idea why this is happening? I thought it wasn't working at all - until I tried phpinfo() and it worked. It seems very strange to me...any thoughts?

Thanks,

Robin

----------

## alexlm78

Very usefully, thannks a lot.   :Exclamation: 

----------

## fidel

 *Boosty wrote:*   

> 
> 
> Ok thanks for the checking this.  I never used MultiViews in Apache 1or 2, and I neither use much suPHP, tried it some time ago, but atm I use suEXEC+mod_fastcgi+PHP-cgi to serve .php pages. 

 

I now spent about 17 hours in order to get apache2 to run with suEXEC and mod_fastcgi. Then I thought I give up and try to use suPHP instead, this gives me about the same headache. I just can't get my websites parsed correctly with either suEXEC and mod_fastcgi or with suPHP. For the suPHP solution I followed the howto

http://www.gentoo.org/proj/en/php/php4-php5-configuration.xml#doc_chap4

and get the 500 error from apache:

```
Script "/mnt/xulp/tests/tests/index.php" resolving to "/mnt/xulp/tests/tests/index.php" not within configured docroot
```

Its a virtual host... with the following line in the virtual host config:

```
DocumentRoot /mnt/xulp/tests/tests
```

-->??   :Confused: 

Has anybody an idea where to find some useful information on how to deal with suEXEC and mod_fastcgi that does work?..

----------

## llongi

 *fidel wrote:*   

> 
> 
> ```
> Script "/mnt/xulp/tests/tests/index.php" resolving to "/mnt/xulp/tests/tests/index.php" not within configured docroot
> ```
> ...

 

mod_fastcgi+suEXEC are relatively complicated to setup imho, I prefer to use suPHP... The error suPHP gives you is self-explanatory: /mnt/xulp/... is not within the configured documentroot of /var/www. suPHP checks if the scripts it has to execute are within a defined directory, and if not, refuses to execute them. This directory can be configured in /etc/suphp.conf, don't forget to restart Apache after editing it.

----------

## fidel

Thanks a lot for your reply!

Well, can I just add as many directories I want or is this limited to the main directory?... I like to keep the webdocs on a separate partition...

If not, can I load suPHP parrallel with PHP5 in order to have suPHP executing those scripts on my separate partition and mod_php everything in /var/www/localhost ?

Thanks! I really appreciate this!

----------

## fidel

I changed the configuration in /etc/suphp.conf and changed

```
;Check wheter script is within DOCUMENT_ROOT

check_vhost_docroot=false

```

I configured apache in /etc/conf.d/apache2 with:

```

APACHE2_OPTS="-D DEFAULT_VHOST -D SSL -D SSL_DEFAULT_VHOST  -D SUPHP"

```

Now I get the following error in the log file, whereas in the browser I got the message that the site cannot be shown:

```
[Thu Jun 22 16:28:07 2006] [notice] Apache configured -- resuming normal operations

[Thu Jun 22 16:28:27 2006] [error] [client 62.2.78.194] *** glibc detected *** double free or corruption (fasttop): 0x000000000052ce60 ***

```

Am I still misconfiguring things or is my system broken?...

Thanks in advance for any help!

Greets

----------

## llongi

 *fidel wrote:*   

> 
> 
> Now I get the following error in the log file, whereas in the browser I got the message that the site cannot be shown:
> 
> ```
> ...

 

Uhmm this looks more like a problem of one of the apps... Try the latest unstable dev-lang/php (with "cgi" USE flag enabled!) and the latest unstable mod_suphp... It's worth a shot, though I'm not sure it will solve the problem for sure.

----------

## fidel

Thanks for the hint! I did so, unfortunately though I got the same error. 

```
[Fri Jun 23 18:21:34 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)

[Fri Jun 23 18:21:34 2006] [notice] Digest: generating secret for digest authentication ...

[Fri Jun 23 18:21:34 2006] [notice] Digest: done

[Fri Jun 23 18:21:34 2006] [notice] Apache configured -- resuming normal operations

[Fri Jun 23 18:21:49 2006] [error] [client 192.168.1.50] *** glibc detected *** double free or corruption (fasttop): 0x000000000052d0b0 ***

[Fri Jun 23 18:22:01 2006] [error] [client 192.168.1.50] *** glibc detected *** double free or corruption (fasttop): 0x000000000052d0c0 ***

```

As well very strange that even after I edited the config file /etc/suphp.conf to read check_vhost_docroot=false the error still appears, the script wouldn't be in my configured doc root...

Ok, I give up! Whether mod_fastcgi with suEXEC nor suPHP seems to work for me, don't know if that is related to the amd64 arch I am running there... Sad! I know have to think about a vserver... what a shame, all I want is to have those php scripts executed as the users owning them. Oh well, maybe in the future it will work better, or maybe I'll have to switch to x86?..

Thanks anyway! 

Greets 

fidel

----------

## Sperlock

I'm having a problem similar to what robintw encountered.  Apache is loading php5, but Firefox asks to download the php file.  I placed a php file in /var/www/localhost/htdocs that simply calls phpinfo().  I'm banging my head against the wall and am about ready to give up using PHP in Gentoo at this point.  I'd really appreciate any help in getting this working.

 *robintw wrote:*   

> Hi all,
> 
> I've followed the tutorial in the first post of this thread and have the following problem. If I try and access the file test.php in my webservers root directory (http://robinwilson.homelinux.com/test.php if you want to try it) it works fine and gives me the output of phpinfo(). When I try to access http://robinwilson.homelinux.com/blog/ however, or http://robinwilson.homelinux.com/ - both of which have index.php's it fails and firefox asks to download the php file.
> 
> Does anyone have any idea why this is happening? I thought it wasn't working at all - until I tried phpinfo() and it worked. It seems very strange to me...any thoughts?
> ...

 

----------

## fidel

This is kind of weird, can you post your /etc/apache2/modules.d/70_mod_php5.conf and your /etc/conf.d/apache2 (if you're using apache2...)?

----------

## Sperlock

/etc/apache2/modules.d/70_mod_php5.conf:

```

<IfDefine PHP5>

        # Load the module first

        <IfModule !mod_php5.c>

                LoadModule php5_module    modules/libphp5.so

        </IfModule>

        # Set it to handle the files

        <IfModule mod_mime.c>

                AddType application/x-httpd-php .php

                AddType application/x-httpd-php .phtml

                AddType application/x-httpd-php .php3

                AddType application/x-httpd-php .php4

                AddType application/x-httpd-php .php5

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

        </IfModule>

        AddDirectoryIndex index.php index.phtml

</IfDefine>

```

/etc/conf.d/apache2:

```

APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D INFO"

# Extended options for advanced uses of Apache ONLY

# You don't need to edit these unless you are doing crazy Apache stuff

# As not having them set correctly, or feeding in an incorrect configuration

# via them will result in Apache failing to start

# YOU HAVE BEEN WARNED.

# ServerRoot setting

SERVERROOT=/usr/lib/apache2

# Configuration file location

# - If this does NOT start with a '/', then it is treated relative to

# $SERVERROOT by Apache

CONFIGFILE=/etc/apache2/httpd.conf

# Location to log startup errors to

# They are normally dumped to your terminal.

#STARTUPERRORLOG="/var/log/apache2/startuperror.log"

# Environment variables to keep

# All environment variables are cleared from apache

# Use this to preserve some of them

# NOTE!!! It's very important that this contains PATH

# Also, it will fail if the _value_ of any of these variables contains a space

KEEPENV="PATH"

```

I had uncommented these in trying to get things working, but of course it made no difference.[/code]

----------

## fidel

Looks quite reasonable!... hmm, don't really know. You can check what you get with smthg. like # php-cgi --info or pipe it to a file in order to look at it in a browser # php-cgi --info >info.html 

If you get reasonable settings for your php environment it seems that apache just doesnt't execute the php file using the php module.. Sorry, don't know why...

----------

## Sperlock

As I am not running php-cgi, I did run php --info.  I'm not seeing anything obvious that tells me "don't work with Apache" (I see no reference to apache at all), but I do see the Server API as the Command Line Interface.  Maybe this is correct and the only other alternative is cgi.

----------

## fidel

Oops:

As I can see you try to load the mod_php module into apache (the line in /etc/conf.d/apache2: APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D INFO")

Since the cgi-version of apache is here for using with apache and the cli version of apache is here for using php on the commandline, I suggest, you remerge php with the useflag "cgi"

--> Pay attention to the followin useflags:

```
# euse -i cgi

global use flags (searching: cgi)

************************************************************

no matching entries found

local use flags (searching: cgi)

************************************************************

[-    ] cgi (dev-lang/php):

Enable CGI SAPI

....

# euse -i cli

global use flags (searching: cli)

************************************************************

no matching entries found

local use flags (searching: cli)

************************************************************

[+  D ] cli (dev-lang/php):

Enable CLI SAPI

```

So just do the following:

```
# echo "dev-lang/php cgi" >> /etc/portage/package.use

# emerge dev-lang/php

```

If you have any PEAR packages or similar on your machine, rebuild those after you built php. You can check if you have any of those installed:

```
# equery list dev-php/

[ Searching for all packages in 'dev-php' among: ]

 * installed packages

[I--] [  ] dev-php/PEAR-Auth_SASL-1.0.1-r1 (0)

[I--] [  ] dev-php/PEAR-Cache-1.5.4-r1 (0)

[I--] [  ] dev-php/PEAR-DB-1.7.6-r1 (0)

[I--] [  ] dev-php/PEAR-Date-1.4.6 (0)

[I--] [  ] dev-php/PEAR-File-1.2.2 (0)

[I--] [  ] dev-php/PEAR-HTTP_Request-1.3.0 (0)

[I--] [  ] dev-php/PEAR-Log-1.9.3 (0)

[I--] [  ] dev-php/PEAR-Mail-1.1.9 (0)

[I--] [  ] dev-php/PEAR-Mail_Mime-1.3.1-r1 (0)

[I--] [  ] dev-php/PEAR-Net_DIME-0.3-r1 (0)

[I--] [  ] dev-php/PEAR-Net_SMTP-1.2.7 (0)

[I--] [  ] dev-php/PEAR-Net_Sieve-1.1.1-r1 (0)

[I--] [  ] dev-php/PEAR-Net_Socket-1.0.6-r1 (0)

[I--] [  ] dev-php/PEAR-Net_URL-1.0.14-r1 (0)

[I--] [  ] dev-php/PEAR-PEAR-1.4.9-r1 (0)

[I--] [  ] dev-php/PEAR-SOAP-0.9.1 (0)

[I--] [  ] dev-php/PEAR-Services_Weather-1.3.2-r1 (0)

[I--] [  ] dev-php/PEAR-XML_Parser-1.2.7 (0)

[I--] [  ] dev-php/PEAR-XML_Serializer-0.18.0 (0)

[I--] [  ] dev-php/PEAR-XML_Util-1.1.1-r1 (0)

# equery list dev-php5/

[ Searching for all packages in 'dev-php5' among: ]

 * installed packages

[I--] [  ] dev-php5/pecl-mcve-5.2.0 (0)

[I--] [  ] dev-php5/pecl-zip-1.0 (0)

[I--] [  ] dev-php5/php-java-bridge-2.0.8 (0)

```

You can pipe the output of this into a file, like # equery list dev-php/ > phppacks; equery list dev-php5/ >> phppacks; 

Then just enter # emerge `cat phppacks` (remove the first line before!..)

Leave your apache settings and restart apache after the rebuilds, your apache should run fine, load mod_php and execute your php files!

Hope that helps!

Greets

fidel

----------

## Sperlock

I've recompiled PHP with the cgi flag and it has made no difference.

----------

## fidel

This one seems to be quite a tricky one!.... I suggest we try to find out why by checking more on configs and errors...

Could you give some output (just the last lines...) of /var/log/apache2/error_log, /var/log/apache2/access_log and show your /etc/make.conf?

----------

## Sperlock

access_log is empty (I've restarted apache2 and tried accessing my .php file with phpinfo().

error_log:

```
[Mon Jul 31 17:13:54 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)

[Mon Jul 31 17:13:54 2006] [notice] Digest: generating secret for digest authentication ...

[Mon Jul 31 17:13:54 2006] [notice] Digest: done

[Mon Jul 31 17:13:55 2006] [notice] Apache configured -- resuming normal operations

```

make.conf:

```
# Copyright 2000-2002 Daniel Robbins, Gentoo Technologies, Inc.

# Contains local system settings for Portage system

# Please review 'man make.conf' for more information.

# Build-time functionality

# ========================

#

# The USE variable is used to enable optional build-time functionality. For

# example, quite a few packages have optional X, gtk or GNOME functionality

# that can only be enabled or disabled at compile-time. Gentoo Linux has a

# very extensive set of USE variables described in our USE variable HOWTO at

# http://www.gentoo.org/doc/use-howto.html

#

# The available list of use flags with descriptions is in your portage tree.

# Use 'less' to view them:  --> less /usr/portage/profiles/use.desc <--

#

# Example:

USE="aac alsa apache2 berkdb bonobo bzip2 calendar cdparanoia cdr cgi cjk cli ctype dvd dvdr divx4linux effects -esd exif fam force-cgi-redirect gd gphoto2 gstreamer hardenedphp hash icq iconv imap innodb jabber java jikes jpeg2k kdexdeltas mbox memlimit mmx -mozilla matroska mozsvg mpm-prefork mysql mysqli nls nomac nsplugin offensive oscar -oss pam pcre pdo perl pic posix plugin real reflection scanner seamonkey session simplexml soap sockets spl sqlite sse ssl svg symlink tcltk theora tidy tiff tokenizer truetype unicode usb videos win32codecs xml xml2 xmlreader xmlrpc xmlwriter xmms xsl yahoo zip zlib"

INPUT_DEVICES="keyboard mouse"

VIDEO_CARDS="vga nvidia"

LINGUAS="en"

# Host Setting

# ============

#

# If you are using a Pentium Pro or greater processor, leave this line as-is;

# otherwise, change to i586, i486 or i386 as appropriate. All modern systems

# (even Athlons) should use "i686-pc-linux-gnu"

#

CHOST="i686-pc-linux-gnu"

# Host and optimization settings

# ==============================

#

# For optimal performance, enable a CFLAGS setting appropriate for your CPU

#

# -mcpu=<cpu-type> means optimize code for the particular type of CPU without

# breaking compatibility with other CPUs.

#

# -march=<cpu-type> means to take full advantage of the ABI and instructions

# for the particular CPU; this will break compatibility with older CPUs (for

# example, -march=athlon-xp code will not run on a regular Athlon, and

# -march=i686 code will not run on a Pentium Classic.

#

# CPU types supported in gcc-3.2 and higher: athlon-xp, athlon-mp, athlon-4,

# athlon-tbird, athlon, k6, k6-2, k6-3, i386, i486, i586 (Pentium), i686

# (PentiumPro), pentium, pentium-mmx, pentiumpro, pentium2 (Celeron), pentium3,

# and pentium4. Note that Gentoo Linux 1.4 and higher include at least gcc-3.2.

#

# CPU types supported in gcc-2.95*: k6, i386, i486, i586 (Pentium), i686

# (Pentium Pro), pentium, pentiumpro Gentoo Linux 1.2 and below use gcc-2.95*

#

# Decent examples:

#

#CFLAGS="-mcpu=athlon-xp -O3 -pipe"

CFLAGS="-O3 -march=pentium4 -funroll-loops -fprefetch-loop-arrays -pipe"

# If you set a CFLAGS above, then this line will set your default C++ flags to

# the same settings. If you don't set CFLAGS above, then comment this line out.

CXXFLAGS="${CFLAGS}"

# Advanced Masking

# ================

#

# Gentoo is using a new masking system to allow for easier stability testing

# on packages. KEYWORDS are used in ebuilds to mask and unmask packages based

# on the platform they are set for. A special form has been added that

# indicates packages and revisions that are expected to work, but have not yet

# been approved for the stable set. '~arch' is a superset of 'arch' which

# includes the unstable, in testing, packages. Users of the 'x86' architecture

# would add '~x86' to ACCEPT_KEYWORDS to enable unstable/testing packages.

# '~ppc', '~sparc', '~sparc64' are the unstable KEYWORDS for their respective

# platforms. DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.

# IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.

#

#ACCEPT_KEYWORDS="~arch"

# Portage Directories

# ===================

#

# Each of these settings controls an aspect of portage's storage and file

# system usage. If you change any of these, be sure it is available when

# you try to use portage. *** DO NOT INCLUDE A TRAILING "/" ***

#

# PORTAGE_TMPDIR is the location portage will use for compilations and

#     temporary storage of data. This can get VERY large depending upon

#     the application being installed.

#PORTAGE_TMPDIR="/var/tmp"

#

# PORTDIR is the location of the portage tree. This is the repository

#     for all profile information as well as all ebuilds. This directory

#     itself can reach 200M. WE DO NOT RECOMMEND that you change this.

#PORTDIR="/usr/portage"

#

# DISTDIR is where all of the source code tarballs will be placed for

#     emerges. The source code is maintained here unless you delete

#     it. The entire repository of tarballs for gentoo is 9G. This is

#     considerably more than any user will ever download. 2-3G is

#     a large DISTDIR.

#DISTDIR="${PORTDIR}/distfiles"

#

# PKGDIR is the location of binary packages that you can have created

#     with '--buildpkg' or '-b' while emerging a package. This can get

#     upto several hundred megs, or even a few gigs.

#PKGDIR="${PORTDIR}/packages"

#

# PORTDIR_OVERLAY is a directory where local ebuilds may be stored without

#     concern that they will be deleted by rsync updates. Default is not

#     defined.

#PORTDIR_OVERLAY="/usr/local/portage"

# Fetching files

# ==============

#

# If you need to set a proxy for wget or lukemftp, add the appropriate "export

# ftp_proxy=<proxy>" and "export http_proxy=<proxy>" lines to /etc/profile if

# all users on your system should use them.

#

# Portage uses wget by default. Here are some settings for some alternate

# downloaders -- note that you need to merge these programs first before they

# will be available.

#

# Lukemftp (BSD ftp):

#FETCHCOMMAND="/usr/bin/lukemftp -s -a -o \${DISTDIR}/\${FILE} \${URI}"

#RESUMECOMMAND="/usr/bin/lukemftp -s -a -R -o \${DISTDIR}/\${FILE} \${URI}"

#

# Prozilla (turbo downloader)

#FETCHCOMMAND='/usr/bin/proz --no-getch -s ${URI} -P ${DISTDIR}'

# Advanced Features

# =================

#

# MAKEOPTS provides extra options that may be passed to 'make' when a

#     program is compiled. Presently the only use is for specifying

#     the number of parallel makes (-j) to perform. The suggested number

#     for parallel makes is CPUs+1.

MAKEOPTS="-j2"

#

# AUTOCLEAN enables portage to automatically clean out older or overlapping

#     packages from the system after every successful merge. This is the

#     same as running 'emerge -c' after every merge. Set with: "yes" or "no".

AUTOCLEAN="yes"

#

# FEATURES are settings that affect the functionality of portage. Most of

#     these settings are for developer use, but some are available to non-

#     developers as well. 'buildpkg' is an always-on setting for the emerge

#     flag of the same name. It causes binary packages to be created of all

#     packages that are merged.

#FEATURES="sandbox ccache buildpkg"

#FEATURES="gpg candy"

#

# RSYNC_RETRIES sets the number of times portage will attempt to retrieve

#     a current portage tree before it exits with an error. This allows

#     for a more successful retrieval without user intervention most times.

#RSYNC_RETRIES="3"

GENTOO_MIRRORS="rsync://gentoo.seren.com/gentoo ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://cudlug.cudenver.edu/gentoo/ ht

tp://gentoo.ccccom.com"

```

Thanks!

----------

## fidel

Your make.conf contains quite aggressive CFLAGS. I suggest you only use save CFLAGS until your system works fine. If you then feel you could optimize your system using other CFLAGS feel free. I used similar flags before and encountered huge problems concerning some applications....

Check this out:

http://gentoo-wiki.com/Safe_Cflags

This doesn't mean that the problem relies on them for sure, it could be though...

I am awfully sorry, but it seems I can't figure out why your apache doesn't execute the php-file... ehm, stupid question, but oh well, let's try anyway... can you show your php-file?...

----------

## Sperlock

I changed the CFLAGS with what was shown for my CPU on the link you gave and recompiled Apache and PHP.  I restarted Apache and there is no difference.  

Which php-file do you speak of?  I posted 70_mod_php5.conf earlier.  Are you wanting the php.ini file for Apache?

----------

## fidel

No, I meant the file you placed into your document root, the one that should get executed by apache but doesn't... but nevermind, it is a quite desperate attempt to find the problem! I am sorry, I have no idea where the problem lies!

----------

## Sperlock

Well, posting it can't hurt any.

```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head><meta /><title>Test</title>

</head>

<body>

<?php

        phpinfo();

?>

</body>

</html>

```

----------

## yoz-y

i've got a problem emerging php:

```
checking for db4 major version... configure: error: Header contains different version

!!! ERROR: dev-lang/php-5.1.6-r4 failed.

Call stack:

  ebuild.sh, line 1546:   Called dyn_compile

  ebuild.sh, line 937:   Called src_compile

  php-5.1.6-r4.ebuild, line 173:   Called src_compile_normal

  php-5.1.6-r4.ebuild, line 323:   Called php5_1-sapi_src_compile

  php5_1-sapi.eclass, line 575:   Called die
```

i saw that somebody already had this error and some checks were required so:

```
yoz-y@mireille:~> ls -lah /usr/include/db.h                                                                                             17:33

lrwxrwxrwx  1 root root 10 Oct  7 16:59 /usr/include/db.h -> db4.2/db.h

yoz-y@mireille:~> emerge -Cpv sys-libs/db | grep selected                                                                               17:33

    selected: 4.2.52_p2-r1

yoz-y@mireille:~> emerge -pv dev-lang/php                                                                                               17:33

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild  N    ] dev-lang/php-5.1.6-r4  USE="apache2 berkdb cjk cli crypt gdbm ipv6 ldap mysql ncurses nls pcre postgres readline reflection session spell spl ssl truetype unicode xml zlib -adabas -apache -bcmath -birdstep -bzip2 -calendar -cdb -cgi -concurrentmodphp -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filepro -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd -gd-external -gmp -hardenedphp -hash -hyperwave-api -iconv -imap -informix -inifile -interbase -iodbc -java-external -kerberos -libedit -mcve -memlimit -mhash -ming -msql -mssql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -pdo-external -pic -posix -qdbm -recode -sapdb -sasl -sharedext -sharedmem -simplexml -snmp -soap -sockets -solid -sqlite -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer -vm-goto -vm-switch -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip" 0 kB

Total size of downloads: 0 kB

```

i synced my portage and recompiled db just before trying to install php

anybody got any hints please ?

EDIT: used the -berkdb flag and it works... however i still have problems with db in other builds

----------

