LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-17-2009, 03:12 PM   #1
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Rep: Reputation: 30
php 5 and apache issues


Hey all,
Having one hell of a time trying to get PHP 5 working with apache (Server version: Apache/2.0.52). Currently :

Code:
[root@web2 php-5.2.10]$php -v
PHP 4.3.9 (cgi) (built: Sep 12 2007 11:13:32)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
[root@web2 php-5.2.10]$
I have tried a number of tutorials, and keep coming up with this error (for both php-5-3.0 & php-5.2.10) when I run "make" after running configure (as seen below)

Code:
/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1
I have tried various versions of
Code:
[root@web2 php-5.2.10]$./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-gd --with-openssl --with-libdir=lib64
IT started with this:
Code:
[root@web2 php-5.3.0]$./configure --prefix=/usr/local/php5 \
> --with-apxs2=/usr/local/apache2/bin/apxs \
> --with-mysql \		-- ERRORS WITH MYSQL
> --with-gd \
> --enable-sockets \
> --with-openssl \
> --with-libxml-dir=/usr/lib64 \
> --with-zlib --with-zlib-dir=/usr/lib64 \
> --with-libdir=lib64 --with-png-dir
but same errors.
Any ideas?
Thanks so much!
 
Old 09-17-2009, 03:29 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,841

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
The correct option for 64 bit libs, is:
Code:
–with-libdir=/lib64
 
Old 09-17-2009, 03:49 PM   #3
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Original Poster
Rep: Reputation: 30
I tried this:
Code:
$ ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-libdir=/lib64

$ make
and still got the same error after running make.

Code:
 :
 :
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1
 
Old 09-17-2009, 03:56 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,841

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Take a look at this post here at LQ.

Regards
 
Old 09-17-2009, 04:23 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,521

Rep: Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619
this is the VERY old apache 2.0.52 and NOT the current Apache 2.2.13

off hand i dont think that apache 2.0 worked with php 5 ( php4 was the default)

if you NEED to stay with the old apache you might need to rebuild the old apache2.0 from source ,in order to get php 5 to work with it .
 
Old 09-17-2009, 04:48 PM   #6
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Original Poster
Rep: Reputation: 30
In terms on apache version, you are correct, I have built from source and run "make" "make install" for the lastest version of apache, and trying to compile php5 with apache 2.2.13

I have installed (or thought i installed) the latest version of apache, but when I run
Code:
$ apachectl -v
I still get
Code:
[root@web2 ~]$/usr/sbin/apachectl -v
Server version: Apache/2.0.52
Server built:   May  9 2008 05:55:16
bathory,
Thanks for your help! I looked at that post, and added the 2 items to the configure script, ran configure and make (same error). Then added "include /usr/local/lib to the /etc/ld.so.conf file and ran "ldconfig", yet still same error.

any reason apachectl -v still shows the older version of apache ?
 
Old 09-17-2009, 05:18 PM   #7
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by John VV
off hand i dont think that apache 2.0 worked with php 5 ( php4 was the default)
FWIW, I can confirm that Apache 2.0 gets along fine with php 5.

Code:
# uname -rms
FreeBSD 6.4-RELEASE-p5 i386

# httpd -v
Server version: Apache/2.0.63
Server built:   Aug 10 2009 18:37:39

# grep 'libphp5' /usr/local/etc/apache2/httpd.conf
LoadModule php5_module        libexec/apache2/libphp5.so
Apache 2.0 is still well supported as a "legacy" app, BTW. (Mostly gets bugfixes and security updates.)
 
Old 09-18-2009, 12:38 AM   #8
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Not much help, but with regards to your first code block in post #1

When you are in the directory php-5.2.10 and you execute the php -v command, it will execute the command that is in the PATH, not the one in that directory. You can use ./php -v to execute a command that is in the current directory.

This does not solve your other problems though.
 
Old 09-18-2009, 12:43 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,841

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Quote:
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
Why ld is using the libraries from /usr/local/lib? Is it the 1st entry in /etc/ld.so.conf, or you have set a LD_LIBRARY_PATH with /usr/local/lib as 1st entry?
IIRC there is also a "bug" with the libz and libpng used at compile time. I think that ./configure picks the 32 bit libs
You can overcome to this using:
Code:
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-libdir=lib64 --libdir=/usr/lib64 --with-zlib-dir=/usr/lib64 --with-png-dir=/usr/lib64 ...
Don't forget to run "make distclean" after any unsuccessful build.

Regards
 
Old 09-18-2009, 08:03 AM   #10
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Original Poster
Rep: Reputation: 30
bathory,
Thanks for the tip, but no luck.

I changed the following (and still same error)
For some reason I had added "/usr/local/lib" to /etc/ld.so.conf
I took that out, which left
Code:
include ld.so.conf.d/*.conf
The contents of ALL the ld.so.conf.d/*.conf is:
Code:
[root@web2 php-5.2.10]$cat /etc/ld.so.conf.d/*
/usr/lib/mysql
/usr/lib64/mysql
/usr/lib/mysql
/usr/lib64/mysql
/usr/lib/qt-3.3/lib
/usr/lib64/qt-3.3/lib
/usr/X11R6/lib
/usr/X11R6/lib64
So i tried to move all reference to lib64 files INTO ld.so.conf and removed the "include", so /etc/ld.so.conf now contained:
Code:
[root@web2 php-5.2.10]$cat /etc/ld.so.conf
/usr/lib64/mysql
/usr/lib64/mysql
/usr/lib64/qt-3.3/lib
/usr/X11R6/lib64
and STILL SAME ERROR
Code:
 :
 :
_functions.lo -lcrypt -lcrypt -lrt -lpng -lz -lz -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt  -o libphp5.la
/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
I am not configuring with mysql, i don't understand why this is even necessary. I can't be the only person with this issue?

If I run php config without any options, it works properly and then php -v reports:
Code:
[root@web2 php-5.2.10]$php -v
PHP 5.2.10 (cli) (built: Sep 17 2009 23:31:53)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
HOWEVER, its not configured with apache, which is rather worthless
Thanks for your help.
 
Old 09-18-2009, 08:56 AM   #11
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,841

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Quote:
/usr/local/lib/libz.a: could not read symbols: Bad value
It still picks the wrong library. Did you run "make distclean" after make fails?
Maybe you can try
Code:
LDFLAGS=-L/usr/lib64 ./configure ...
BTW, is your apache 2.2.13 compiled to be a 64 bit app?
Code:
/usr/local/apache/bin/httpd -V|grep Arch
Because even if you could build 64 bit php it's not going to work.

Last edited by bathory; 09-18-2009 at 08:57 AM.
 
Old 09-18-2009, 09:20 AM   #12
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Original Poster
Rep: Reputation: 30
yes, after every make "re-try" i run "make distclean", then re-configure and re "make".

And maybe im missing something with apache. I downloaded the 2.2 source and installed it (as instructions say). Configure, make, make install. Ive stopped service, and rebooted machine, but "httpd -v" reports previous verions??
Code:
[root@web2 ~]$/usr/local/apache2/bin/httpd -V | grep version
Server version: Apache/2.2.13 (Unix)
[root@web2 ~]$httpd -v
Server version: Apache/2.0.52
Server built:   May  9 2008 05:55:16
[root@web2 ~]$
I also tried to use the LD as you instruct, then run config, then make, and still get:
Code:
 :
 :
ext/xmlreader/.libs/php_xmlreader.o(.text+0x135c): In function `zim_xmlreader_setSchema':
/root/SRC/php-5.2.10/ext/xmlreader/php_xmlreader.c:983: undefined reference to `xmlTextReaderSchemaValidate'
ext/xmlreader/.libs/php_xmlreader.o(.text+0x160b): In function `zim_xmlreader_XML':
/root/SRC/php-5.2.10/ext/xmlreader/php_xmlreader.c:1109: undefined reference to `xmlTextReaderSetup'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
 
Old 09-18-2009, 03:36 PM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,841

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Quote:
And maybe im missing something with apache. I downloaded the 2.2 source and installed it (as instructions say). Configure, make, make install. Ive stopped service, and rebooted machine, but "httpd -v" reports previous verions??
That's because /usr/local/apache2/bin isn't in your PATH. If your apache build is 32 bit you cannot use a php module compiled for 64 bit.
The error you get now is different. You must scroll up the make output until you find what the real error is (some missing header file maybe).
Also I guess you ran ldconfig when you change the libs order in /etc/ld.so.conf.

BTW what distro are you using? Aren't there any 64 bit apache-2.2.x and php5 packages for it?
 
  


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
Please help with Apache Web Server / Apache Tomcat / PHP / Java / PHP-Java Bridge jpmad4it Linux - Server 2 01-05-2009 06:07 AM
Weird apache ssl and php issues skibler1223 Linux - Server 2 08-05-2008 12:35 PM
Measuring some Apache-PHP load issues narc Linux - Server 1 05-24-2007 05:26 AM
Apache 2, PHP and MYSQL Issues. carpediem Linux - Distributions 3 04-17-2004 08:11 AM
PHP 4.2 and Apache Issues Peejay Linux - Software 2 06-17-2002 11:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:15 AM.

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
Open Source Consulting | Domain Registration