Re: PHP doesn't work with Apache2
| From: | BuildSmart | Date: | Sun, 25 Nov 2007 00:43:53 +0000 |
| Subject: | Re: PHP doesn't work with Apache2 | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-18397@lists.php.net to get a copy of this message | ||
On Nov 24, 2007, at 18:31:52, ApplePro wrote:
BuildSmart <buildsmart <at> daleenterprise.com> writes:Knowing about your environment and tools helps you build software, since I don't know what you have I can only guess and I guess your environment isn't as advanced as I had originally thought. Like I said, I'm not certain which arch's your compiler supports but I'm guessing that it doesn't support "-arch i386" so remove those and just use "-arch x86_64".This tells me you were not in the php source directory where you issued the configure and make commands. You're building php in /tmp and not /usr/src.Yes. It worked for all software exceprt PHP.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.5As I understand I need to put PHP source to this directory. I've unpacked PHP source to: /SourceCache/php-5.2.5Your 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 moduleI've erased 5.2.3 directory. When I'm trying to run "file" for 5.2.5, I get this: [root@fc php-5.2.5]# file /etc/httpd/modules/libphp5.so /etc/httpd/modules/libphp5.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), not strippedHERE 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-xmlwriterI'm getting this error when I'm trying to configure: creating cache ../config.cache checking for Cygwin environment... no checking for mingw32 environment... no checking for egrep... grep -E checking for a sed that does not truncate output... /bin/sed checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-redhat-linux-gnu checking for gcc... gcc checking whether the C compiler (gcc -arch i386 -arch x86_64 -pipe -no-cpp-precomp -arch i386 -arch x86_64) works... no configure: error: installation or configuration problem: C compiler cannot create executables.
Don't worry about it.make ls -lsa $(find . -name libphp5.so)After previous configuration didn't work, I've tried mine, output for ls -lsa $(find . -name libphp5.so): 11932 -rwxr-xr-x 1 root root 12201952 Nov 24 15:12 ./.libs/libphp5.so 11932 -rwxr-xr-x 1 root root 12201952 Nov 24 15:12 ./libs/libphp5.somake install It will tell you what directory it has installed the sapi module (this is thelibphp5.so file).You should see something like:With my configuration: [root@fc php-5.2.5]# make installInstalling 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.Installing PHP SAPI module: apache2handler /usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool'libphp5.la /usr/lib64/httpd/modules /usr/lib64/apr-1/build/libtool --mode=install cp libphp5.la /usr/lib64/httpd/modules/ cp .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so cp .libs/libphp5.lai /usr/lib64/httpd/modules/libphp5.la libtool: install: warning: remember to run `libtool --finish /SourceCache/php-5.2.5/libs' chmod 755 /usr/lib64/httpd/modules/libphp5.so [activating module `php5' in /etc/httpd/conf/httpd.conf]Installing PHP CLI binary: /usr/bin/ Installing PHP CLI man page: /usr/share/man/man1/ Installing build environment: /usr/lib64/build/ Installing header files: /usr/include/php/ Installing helper programs: /usr/bin/program: phpize program: php-configInstalling man pages: /usr/share/man/man1/page: phpize.1 page: php-config.1I like to know what my environment is like and my tools are tailored in such away 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 caninstall 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.6OpenSSL/0.9.8 PHP/5.2.5 mod_jk/1.2.23Sorry, but I'm not sure about how to get this info.
try this in your httpd.conf file LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so stop and start apache.binfo is a proprietary utility which is part of my developer tools but fileshould provide similar results.My gcc is configured in such a way that I can generate binaries that will runon 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-linuxThread model: posix gcc version 4.0.1 techdata:~ root#The output is: [root@fc php-5.2.5]# file /usr/sbin/httpd /usr/sbin/httpd: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, strippedI wanted you to type: /usr/sbin/apxs -q LIBEXECDIRThe output is: /usr/lib64/httpd/modules
Using file I get the following on my php module: techdata:~ root# file /usr/libexec/httpd/libphp5.so /usr/libexec/httpd/libphp5.so: ELF with 2 architectures /usr/libexec/httpd/libphp5.so: ELF LSB shared object, i386, version 1 (SYSV), for Debian GNU/Linux, stripped /usr/libexec/httpd/libphp5.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), for Debian GNU/Linux, stripped techdata:~ root# I do a little extra post-installation stripping and this can be ignored, you don't even need both architectures, as long as you have the 64bit one in your binary you should be OK.
-- Dale