Re: PHP doesn't work with Apache2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




On Nov 24, 2007, at 13:00:59, ApplePro wrote:

BuildSmart <buildsmart <at> daleenterprise.com> writes:

OK, let's go back to the beginning so you can follow what is required one step
at a time and understand what each step is.

First step, you build and install PHP from source and one of the files is
named libphp5.so and you need to know where it is in the source so you can
verify it against the installed file to ensure it is the same file so after the
make command do:
ls -lsa $(find . -name libphp5.so)

The output for this command is:

--------------------
[root@fc ~]# ls -lsa $(find . -name libphp5.so)
total 264
 8 drwxr-x---  8 root root  4096 Nov 23 07:16 .
 8 drwxr-xr-x 25 root root  4096 Nov 24 07:17 ..
 8 -rw-------  1 root root  1047 Mar 30  2007 anaconda-ks.cfg
72 -rw-------  1 root root 67567 Nov 24 08:05 .bash_history
 8 -rw-r--r--  1 root root    24 Jul 12  2006 .bash_logout
 4 -rw-r--r--  1 root root   208 Nov 23 07:16 .bash_profile
12 -rw-r--r--  1 root root 12288 Nov 23 06:26 .bash_profile.swp
 8 -rw-r--r--  1 root root   176 Jul 12  2006 .bashrc
 4 drwxr-xr-x  2 root root  4096 Oct 29 11:28 bkp
 8 -rw-r--r--  1 root root   100 Jul 12  2006 .cshrc
 4 -rw-------  1 root root    77 Nov  5 14:34 .cvspass
 4 drwxr-xr-x 12 root root  4096 Nov  1 03:02 ffmpeg
 8 drwx------  2 root root  4096 Mar 30  2007 .gconf
 8 drwx------  2 root root  4096 Mar 30  2007 .gconfd
32 -rw-r--r--  1 root root 25803 Mar 30  2007 install.log
12 -rw-r--r--  1 root root  4848 Mar 30  2007 install.log.syslog
 4 -rw-------  1 root root    35 Nov 18 07:06 .lesshst
 4 -rw-r--r--  1 root root    21 Nov 15 12:39 logo
 4 -rw-------  1 root root   280 Nov  5 10:36 .mysql_history
 4 -rw-r--r--  1 root root  2979 Apr  1  2007 README
 4 -rw-------  1 root root  1024 Jul 19 01:46 .rnd
16 -rw-r--r--  1 root root 13901 Apr  1  2007 rpm.list
 4 drwxr-xr-x  3 root root  4096 Oct 14 06:51 .subversion
 8 -rw-r--r--  1 root root   129 Jul 12  2006 .tcshrc
 4 drwxr-xr-x  4 root root  4096 Nov  6 07:53 .wine
 4 -rw-------  1 root root   134 Aug 20 02:26 .Xauthority
--------------------


This tells me you were not in the php source directory where you issued the configure and make commands.


Second step, what is the actual path of the new installed libphp5.so file?

I've searched for it with "find / -name libphp5.so" and the outpur is:


--------------------
/usr/src/php-5.2.3/.libs/libphp5.so
/usr/src/php-5.2.3/libs/libphp5.so
/tmp/php-5.2.5/.libs/libphp5.so
/tmp/php-5.2.5/libs/libphp5.so

You're building php in /tmp and not /usr/src.

Let's back up even more since it's clear you're not entirely sure what your doing so lets try using a schema in the build process so you will be in the correct directory and I will also know where you should be and will be.

Place the uncompressed php source in the drive root.

mkdir -p /SourceCache/tarball

Copy or move the php source tarball to the /SourceCache/tarball directory.

cd /SourceCache


Use one of the following to expand the source

tar -xjvf tarball/php-5.2.5.tar.bz2; # this is for a .bz2 file
tar -xzvf tarball/php-5.2.5.tar.gz; # this is for a .gz file


cd /SourceCache/php-5.2.5

Your original configure command has conflict issues so here is a cleaned up one.

Since it appears that your OS is 64bit savy apache may be running in 64bit mode and I believe the two arches required are i386 and x86_64 or i586 and x86_64 but of course this also depends on your gcc and how it was compiled for your OS by whomever you get your packages from, I think you can verify this by use of the "file" command.
file /usr/src/php-5.2.3/libs/libphp5.so; # <-- the working php module

And just for giggle check the one that doesn't work
file /tmp/php-5.2.3/libs/libphp5.so; # <-- the non-working php module


HERE IS YOUR CONFIGURE COMMAND:
CFLAGS="-arch i386 -arch x86_64 -pipe -no-cpp-precomp" \
CCFLAGS="-arch i386 -arch x86_64  -pipe"  \
CXXFLAGS="-arch i386 -arch x86_64  -pipe" \
LDFLAGS="-arch i386 -arch x86_64" \
./configure \
--build=x86_64-unknown-linux-gnu \
--host=x86_64-unknown-linux-gnu \
--target=x86_64-redhat-linux-gnu \
--cache-file=../config.cache \
--with-layout=GNU \
--with-apxs2=/usr/sbin/apxs \
--prefix=/usr \
--libdir=/usr/lib64 \
--localstatedir=/var \
--sharedstatedir=/usr/com \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-pic \
--with-bz2 \
--with-curl \
--with-gd=shared \
--with-freetype-dir=/usr \
--with-png \
--with-png-dir=/usr \
--with-jpeg \
--with-jpeg-dir=/usr \
--with-gettext \
--with-gmp \
--with-iconv \
--with-kerberos \
--with-mime-magic=shared,/usr/share/file/magic.mime \
--with-openssl \
--with-pspell \
--with-expat-dir=/usr \
--with-pcre-regex=/usr \
--with-unixODBC=shared,/usr \
--with-xml \
--with-libxml-dir=/usr \
--with-zlib \
--enable-calendar \
--enable-dbx \
--enable-dio \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf \
--enable-magic-quotes \
--enable-memory-limit \
--enable-shmop \
--enable-sockets \
--enable-sysvsem=shared \
--enable-sysvshm=shared \
--enable-sysvmsg=shared \
--enable-track-vars \
--enable-trans-sid \
--enable-ucd-snmp-hack \
--enable-wddx \
--enable-yp \
--without-mysql \
--without-gdbm \
--without-pear \
--without-sqlite \
--disable-dba \
--disable-debug \
--disable-dependency-tracking \
--disable-dom \
--disable-pdo \
--disable-rpath \
--disable-xmlreader \
--disable-xmlwriter

make


ls -lsa $(find . -name libphp5.so)

make install


It will tell you what directory it has installed the sapi module (this is the libphp5.so file).

You should see something like:
Installing PHP SAPI module:       apache
[activating module `php5' in /private/etc/httpd/httpd.conf]
cp libs/libphp5.so /usr/libexec/httpd/libphp5.so
chmod 755 /usr/libexec/httpd/libphp5.so

I have apache installed differently so your paths will be different.


Let me know when you've gotten this far.



I like to know what my environment is like and my tools are tailored in such a way that I can produce binary packages that will work on either 32bit or 64bit OS enabled machines without having to generate seperate builds.

My apache installation is a little more advanced and I build so that I can install the same binary software on any of my machines and know it will work.

Server Version: Apache/2.2.6 (Debian GNU/Linux - 64bit) mod_ssl/2.2.6 OpenSSL/0.9.8 PHP/5.2.5 mod_jk/1.2.23


binfo is a proprietary utility which is part of my developer tools but file should provide similar results.

My gcc is configured in such a way that I can generate binaries that will run on the oldest hardware I have increasing hardware compatibility with my software.

techdata:~ root# binfo /usr/sbin/httpd
/usr/sbin/httpd: Elf binary with 2 architectures
/usr/sbin/httpd (for architecture i386): Elf executable i386
/usr/sbin/httpd (for architecture x86_64): Elf 64-bit executable x86_64
techdata:~ root# gcc -v
Using built-in specs.
Target: i386-debian-linux
Configured with: /var/tmp/gcc/gcc-4.0.1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-debian-linux --program-prefix= --host=i386-debian-linux --target=i386-debian-linux
Thread model: posix
gcc version 4.0.1
techdata:~ root# 


--------------------


First, I've added this module to httpd.conf:
/usr/src/php-5.2.3/libs/libphp5.so

But it's old version.

After I've changed it to:
/tmp/php-5.2.5/libs/libphp5.so

And restarted server, apache stopped working. It doesn't show even HTML now, I
get error "Can't find server".




You need to know that this module is installed in the correct location and you
need to know what this location is.

A HINT: this is usually a path where other apache modules are.

ANOTHER HINT: this should tell you where that directory is.
/usr/sbin/apxs -q LIBEXECDIR


Do you mean Apache module? I've tried to find it with "find / -name apxs" and
the output is:

--------------------
/usr/sbin/apxs
--------------------

I wanted you to type:
/usr/sbin/apxs -q LIBEXECDIR




Verify that the libphp5.so file is in this directory and it's date/size match
that of the one from the apache build

So, I should move it from PHP source directory (/tmp/php-5.2.5/) to /usr/sbin/?

Sorry, but I don't understand what modules you mean. The first one a
/tmp/php-5.2.5/libs/libphp5.so 
I guess. But which one is the second one?



Third piece of information I want is the unmodified line from your httpd.conf
that loads the php module.

These 3 pieces of information will tell you a lot about the installation.

 -- Dale


The line is here:

LoadModule php5_module        /tmp/php-5.2.5/libs/libphp5.so

This is the modified line cause it now points to the module that doesn't work, stick with my build instructions or find a howto to follow that is compliant with your 64bit environment.



-- Dale



Attachment: PGP.sig
Description: This is a digitally signed message part


[Index of Archives]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [Postgresql]     [PHP Books]     [PHP Databases]     [PHP SOAP]
  Powered by Linux