LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-10-2013, 05:15 PM   #1
yenn
Member
 
Registered: Jan 2011
Location: Czech Republic
Distribution: Slackware, Gentoo, FreeBSD
Posts: 160

Rep: Reputation: 21
PHP re-build process


I'm trying to rebuild PHP with PostgreSQL support and I with few tweaks I succeeded. Although I noticed few odd parts of official Slackware slackbuild.

Code:
[root] /tmp/php# sh ./php.SlackBuild 
./php.SlackBuild: line 73: cd: /tmp/php/../alpine: No such file or directory
./php.SlackBuild: line 73: ./alpine.SlackBuild: No such file or directory
According to slackbuild it needs c-client, either from system or build it from alpine source.
Code:
# we need to compile alpine to get c-client.a for IMAP support:
IMAPLIBDIR=/usr/local/lib${LIBDIRSUFFIX}/c-client
if [ -r $IMAPLIBDIR/lib${LIBDIRSUFFIX}/c-client.a ]; then
  echo "Using IMAP library:"
  ls -l $IMAPLIBDIR/lib${LIBDIRSUFFIX}/c-client.a
  sleep 5
else
  ( cd $CWD/../alpine ; ./alpine.SlackBuild || exit 1 ) || exit 1
  ( cd $TMP/re-alpine-${ALPINE}/imap/c-client
    strip -g c-client.a
    mkdir -p $IMAPLIBDIR/lib${LIBDIRSUFFIX}
    cp c-client.a $IMAPLIBDIR/lib${LIBDIRSUFFIX}
    mkdir -p $IMAPLIBDIR/include
    cp *.h $IMAPLIBDIR/include
  )
fi
What is c-client? And if it's build dependency for php, why not include it in alpine package?

Second thing is also quite cryptic.
Code:
# A trick from DaMouse to enable building php into $PKG.
# We'll remove this later on.
cat /etc/httpd/original/httpd.conf > $PKG/etc/httpd/httpd.conf
if [ ! -e /etc/httpd/original/httpd.conf ]; then
  echo "FATAL:  no /etc/httpd/original/httpd.conf found."
  exit 1
fi
I know that Apache is only officially supported webserver in Slackware, but requiring httpd.conf when building php seems quite strange. I thought PHP makefile auto detect libraries and such, so if I for instance try to build PHP with '--with-apsx' and I don't have Apache installed, it would disable apsx and build php as if I didn't request it. Therefore if I modify slackbuild a bit (remove every --enable-something-apache-related) Apache won't be build dependency and then there is no reason for php to touch httpd.conf. Or is there?
 
Old 08-10-2013, 05:22 PM   #2
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1}
Posts: 2,777

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
FWIW - It isn't necessary to rebuild the PHP package if all you want is PostgreSQL support.

You can rebuild PHP using the --with-pgsql=shared,/usr directive, but all you
really need is the module, so an easy way is to rebuild PHP using ONLY the
--with-pgsql... directive, copy the module to the php extensions path and edit
the /etc/httpd/php.ini to enable it's use... like this:

1. Untar the php source and cd to the directory
2. ./configure --with-pgsql=shared,/usr
3. make (DO NOT RUN make install!)
4. copy .../modules/pgsql.so to /usr/lib/php/extensions/pgsql.so
5. Edit /etc/httpd/php.ini and add line 'extension=pgsql.so'

Restart apache and you should be done!

(NOTE: It is NOT necessary to edit /etc/php/php.ini to use the module!)

As far as the httpd dependency in the Slackbuild, I have no good ideas, but a good guess would be that other Slackware packages depend on both php and httpd, so enforcing that in the Slackbuild would prevent breaking other things.

Last edited by astrogeek; 08-10-2013 at 06:58 PM. Reason: Typos, added httpd comment...
 
Old 08-10-2013, 06:49 PM   #3
ljb643
Member
 
Registered: Nov 2003
Posts: 320

Rep: Reputation: Disabled
Quote:
Originally Posted by yenn View Post
...
I know that Apache is only officially supported webserver in Slackware, but requiring httpd.conf when building php seems quite strange...
It may sound odd, but when configuring PHP with Apache2 SAPI, the PHP configure process has to run httpd to get its configuration. This is done to determine which MPM Apache is configure to use. This in turn determines if PHP needs to build with thread safety. (There could be other reasons it needs to check httpd too.) Hence: configure PHP with apxs2 SAPI requires running httpd, which requires an httpd.conf file.

Strange... but true.
 
Old 08-10-2013, 08:48 PM   #4
yenn
Member
 
Registered: Jan 2011
Location: Czech Republic
Distribution: Slackware, Gentoo, FreeBSD
Posts: 160

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by astrogeek View Post
FWIW - It isn't necessary to rebuild the PHP package if all you want is PostgreSQL support.

You can rebuild PHP using the --with-pgsql=shared,/usr directive...
Thanks, its definitely faster that rebuild full PHP. Unfortunately it doesn't work for me.
Code:
$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/pgsql.so' - /usr/lib/php/extensions/pgsql.so: undefined symbol: executor_globals in Unknown on line 0
Any suggestions? I'm running current, but I guess it shouldn't matter.
 
1 members found this post helpful.
Old 08-10-2013, 08:50 PM   #5
yenn
Member
 
Registered: Jan 2011
Location: Czech Republic
Distribution: Slackware, Gentoo, FreeBSD
Posts: 160

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by ljb643 View Post
It may sound odd, but when configuring PHP with Apache2 SAPI, the PHP configure process has to run httpd to get its configuration. This is done to determine which MPM Apache is configure to use. This in turn determines if PHP needs to build with thread safety. (There could be other reasons it needs to check httpd too.) Hence: configure PHP with apxs2 SAPI requires running httpd, which requires an httpd.conf file.

Strange... but true.
Strange, but it make sense. Thanks for explanation.
 
Old 08-11-2013, 01:19 AM   #6
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1}
Posts: 2,777

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Quote:
Originally Posted by yenn View Post
Thanks, its definitely faster that rebuild full PHP. Unfortunately it doesn't work for me.
Code:
$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/pgsql.so' - /usr/lib/php/extensions/pgsql.so: undefined symbol: executor_globals in Unknown on line 0
Any suggestions? I'm running current, but I guess it shouldn't matter.
Well, that was a surprise! I have been using the module rebuild method for several Slackware versions, but had not yet used it on my only -current machine. I tried it after your post and got the same result that you did - bummer!

After a little searching I did not find a definitive answer about what has changed, but I think it has to do with apache that ships in current (anyone have more complete info?).

But I found a solution and have tested it on my -current box. There is a Slackbuild on SBO for php-pgsql, get it here.

Untar it, then copy the php source tarball into the newly created php-pgsql/ directory (get it quickly here, php-5.4.17.tar.xz)

Edit the php-pgsql.Slackbuild script, change two lines...

Code:
VERSION=5.4.17

...

tar xvf $CWD/$SRCNAM-$VERSION.tar.xz (if using xz instead of bz2)
Run the slackbuild and install...
Code:
./php-pgsql.Slackbuild

...

installpkg /tmp/php-pgsql-5.4.17-1_SBo.tgz
This will add a new config file /etc/php/pgsql.ini which you can edit to enable pgsql, or the lines you already enabled in the /etc/httpd/php.ini will serve the same purpose I think.

This works on -current - my apology for any wasted time with the earlier method - my own notes are now updated as well!

Good luck!

Last edited by astrogeek; 08-11-2013 at 01:46 AM.
 
1 members found this post helpful.
Old 08-16-2013, 12:16 PM   #7
yenn
Member
 
Registered: Jan 2011
Location: Czech Republic
Distribution: Slackware, Gentoo, FreeBSD
Posts: 160

Original Poster
Rep: Reputation: 21
Thanks Astrogeek! It works like a charm, when I build it from separate Slackbuild.

Although I'm curious why this Slackbuild works and official one don't. I'm quite busy right now, but as soon as I find a little bit of time, I'll try to investigate that.
 
Old 08-16-2013, 01:33 PM   #8
BrZ
Member
 
Registered: Apr 2009
Distribution: Slackware
Posts: 516

Rep: Reputation: 93
Just an observation: Here, with -current, the SlackBuild script for PHP seems to be looking for 'ALPINE=2.02', but (re)Alpine is 2.03, so when it finish to build the c-client, the copy routine will fail without warn and bork the php compilation...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What to expect from the build process... lostzinzthought Linux From Scratch 5 09-19-2010 03:19 PM
Coding Dilemma: Build application with PHP framework or build all myself? socceroos Programming 2 05-10-2009 06:04 PM
LXer: Add an Auto-Incrementing Build-Number to Your Build Process LXer Syndicated Linux News 0 07-09-2008 01:00 AM
problem with libstdc++-2.8.1 build process kotharavi Fedora 1 06-08-2005 02:48 AM
kernel build process on SuSE 9 questions. Pcghost Linux - Distributions 9 12-05-2003 04:49 PM


All times are GMT -5. The time now is 01:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration