Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO Install PHP5
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ScriptBlue
n00b
n00b


Joined: 27 Jul 2005
Posts: 21
Location: New York City, New York, US

PostPosted: Mon Aug 01, 2005 9:42 pm    Post subject: HOWTO Install PHP5 Reply with quote

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

5)Checking packages
To see which packages will be emerged with what USE flags type
Code:
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,
Code:
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 ;)
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!
[ebuild N ] dev-libs/apr-0.9.6-r3 +ipv6 0 kB
[ebuild N ] dev-libs/apr-util-0.9.6-r2 +berkdb +gdbm -ldap 0 kB
[ebuild N ] net-www/apache-2.0.54-r13 +apache2 -debug -doc -ldap -mpm-leader -mpm-peruser +mpm-prefork -mpm-threadpool -mpm-worker -no-suexec (-selinux) +ssl -static-modules -threads 49 kB
[ebuild N ] dev-lang/php-5.0.4 -adabas -apache +apache2 +bcmath +berkdb -birdstep +bzip2 +calendar -cdb -cgi +cli +crypt -ctype +curl -curlwrappers -db2 -dba -dbase -dbm -dbmaker -dbx -debug -empress -empress-bcs -esoob +exif -fdftk -filepro -firebird -flatfile -frontbase +ftp +gd +gd-external +gdbm -gmp -hardenedphp -hyperwave-api +iconv +imap -informix +inifile -interbase -iodbc +jpeg -kerberos -ldap -libedit -mcve -memlimit -mhash +mime -ming -mkconfig +msession -msql -mssql +mysql -mysqli +ncurses +nls -oci8 -odbc -oracle7 -ovrimos +pcntl -pcre -pear -pfpro +png -posix -postgres -qdbm +readline -recode -sapdb -sasl +session -sharedext -sharedmem +simplexml -snmp -soap +sockets -solid +spell -spl +sqlite +ssl -sybase -sybase-ct -sysvipc -threads -tidy +tiff +tokenizer +truetype -wddx +xml2 +xmlrpc -xpm -xsl +zlib 0 kB

--------
This is my first how to, sorry if it doesn't follow the normal layout, I tried
Back to top
View user's profile Send private message
stuherbert
Retired Dev
Retired Dev


Joined: 17 Aug 2003
Posts: 47
Location: Pontypridd, South Wales

PostPosted: Mon Aug 01, 2005 9:48 pm    Post subject: Reply with quote

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
_________________
--
stuart@gentoo.org
Gentoo Developer
Trustee, Gentoo Foundation
http://blog.stuartherbert.com
Back to top
View user's profile Send private message
stuherbert
Retired Dev
Retired Dev


Joined: 17 Aug 2003
Posts: 47
Location: Pontypridd, South Wales

PostPosted: Mon Aug 01, 2005 9:52 pm    Post subject: Reply with quote

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
_________________
--
stuart@gentoo.org
Gentoo Developer
Trustee, Gentoo Foundation
http://blog.stuartherbert.com
Back to top
View user's profile Send private message
whyscream
n00b
n00b


Joined: 17 Feb 2004
Posts: 46

PostPosted: Tue Aug 02, 2005 8:39 am    Post subject: Reply with quote

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:
Code:
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 :)
Back to top
View user's profile Send private message
mserms
Apprentice
Apprentice


Joined: 13 Jan 2005
Posts: 162
Location: Edinburgh

PostPosted: Tue Aug 02, 2005 9:29 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
YD
Guru
Guru


Joined: 30 Oct 2004
Posts: 466
Location: Riga, Latvia

PostPosted: Tue Aug 02, 2005 9:45 am    Post subject: Reply with quote

Currently I'm using modified portage ebuilds.

  1. Does this tarball work well with MySQL4.1 + mysqli?
  2. Does it have independant mbstring flag (without nls support) ?
  3. 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
Back to top
View user's profile Send private message
andreask
Apprentice
Apprentice


Joined: 09 Sep 2003
Posts: 282
Location: Aachen, Germany

PostPosted: Tue Aug 02, 2005 10:02 am    Post subject: Re: HOWTO Install PHP5 Reply with quote

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
http://httpd.apache.org/docs/2.0/mod/prefork.html
http://ecaimaps.berkeley.edu/manual/mod/leader.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
Back to top
View user's profile Send private message
StifflerStealth
Retired Dev
Retired Dev


Joined: 03 Jul 2002
Posts: 968

PostPosted: Tue Aug 02, 2005 1:47 pm    Post subject: Reply with quote

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
_________________
Nothing to read in this sig. Move along.
Back to top
View user's profile Send private message
mserms
Apprentice
Apprentice


Joined: 13 Jan 2005
Posts: 162
Location: Edinburgh

PostPosted: Tue Aug 02, 2005 3:00 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
stuherbert
Retired Dev
Retired Dev


Joined: 17 Aug 2003
Posts: 47
Location: Pontypridd, South Wales

PostPosted: Tue Aug 02, 2005 4:10 pm    Post subject: Reply with quote

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
_________________
--
stuart@gentoo.org
Gentoo Developer
Trustee, Gentoo Foundation
http://blog.stuartherbert.com
Back to top
View user's profile Send private message
mserms
Apprentice
Apprentice


Joined: 13 Jan 2005
Posts: 162
Location: Edinburgh

PostPosted: Wed Aug 03, 2005 8:20 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
andreask
Apprentice
Apprentice


Joined: 09 Sep 2003
Posts: 282
Location: Aachen, Germany

PostPosted: Wed Aug 03, 2005 8:33 am    Post subject: Reply with quote

Code:
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.
Back to top
View user's profile Send private message
mserms
Apprentice
Apprentice


Joined: 13 Jan 2005
Posts: 162
Location: Edinburgh

PostPosted: Wed Aug 03, 2005 8:36 am    Post subject: Reply with quote

Ah, that's more like it! Thanks andreask.
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Wed Aug 03, 2005 9:57 am    Post subject: Reply with quote

why are this overlay needed? i run php5 perfectly fine with the ebuilds that is currently masked in portage
Back to top
View user's profile Send private message
andreask
Apprentice
Apprentice


Joined: 09 Sep 2003
Posts: 282
Location: Aachen, Germany

PostPosted: Wed Aug 03, 2005 10:13 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Wed Aug 03, 2005 10:32 am    Post subject: Reply with quote

oh well.. when this gets into portage, i will upgrade, but untill then php5 works flawlessly as it is now
Back to top
View user's profile Send private message
stuherbert
Retired Dev
Retired Dev


Joined: 17 Aug 2003
Posts: 47
Location: Pontypridd, South Wales

PostPosted: Wed Aug 03, 2005 10:34 pm    Post subject: Reply with quote

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
_________________
--
stuart@gentoo.org
Gentoo Developer
Trustee, Gentoo Foundation
http://blog.stuartherbert.com
Back to top
View user's profile Send private message
andreask
Apprentice
Apprentice


Joined: 09 Sep 2003
Posts: 282
Location: Aachen, Germany

PostPosted: Wed Aug 03, 2005 10:48 pm    Post subject: Reply with quote

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...) ;-)
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Thu Aug 04, 2005 1:01 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
jonasmattsson
n00b
n00b


Joined: 20 May 2004
Posts: 71
Location: Gothenburg, Sweden

PostPosted: Thu Aug 04, 2005 7:50 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
StifflerStealth
Retired Dev
Retired Dev


Joined: 03 Jul 2002
Posts: 968

PostPosted: Thu Aug 04, 2005 8:41 pm    Post subject: Reply with quote

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:
Code:
/etc/init.d/apache2 restart


That is all I did to get it to work.
_________________
Nothing to read in this sig. Move along.
Back to top
View user's profile Send private message
mserms
Apprentice
Apprentice


Joined: 13 Jan 2005
Posts: 162
Location: Edinburgh

PostPosted: Fri Aug 05, 2005 8:13 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
djcronos
n00b
n00b


Joined: 02 Oct 2004
Posts: 53
Location: San Jose, CA

PostPosted: Mon Aug 08, 2005 6:00 pm    Post subject: Reply with quote

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.
_________________
Linux Lover #370481
Get Counted!
Back to top
View user's profile Send private message
andreask
Apprentice
Apprentice


Joined: 09 Sep 2003
Posts: 282
Location: Aachen, Germany

PostPosted: Mon Aug 08, 2005 6:21 pm    Post subject: Reply with quote

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:

Code:
/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
Code:
/usr/lib/php[45]/bin/php-cgi

binary. If you use the "cli" USE-flag, you will get
Code:
/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.
Back to top
View user's profile Send private message
Styles
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jun 2002
Posts: 82

PostPosted: Tue Aug 09, 2005 7:25 pm    Post subject: Reply with quote

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

Code:
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 ?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
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