0

I installed the latest apache web server on my system using all default configs (simply ./configure, make, make install). Then I was trying to tie PHP5 into it but I can never get it working.

First thing I did was try and get it to work with these settings:

./configure --with-apxs2=/usr/local/apache2/bin/apxs prefix=/usr/local/apache2/php --with-config-file-path=/usr/local/apache2/php --enable-force-cgi-redirect --disable-cgi --enable-shared

That was giving me this error when I was trying to 'make install':

Warning! dlname not found in /usr/local/apache2/modules/libphp5.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache2/modules/libphp5.so
chmod: cannot access `/usr/local/apache2/modules/libphp5.so': No such file or directory
apxs:Error: Command failed with rc=65536

So I tired configuring with no options (other than apxs2) and was able to make and make install. This is the output of that make install:

Installing PHP SAPI module:       apache2handler
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' libphp5.la /usr/local/apache2/modules
/usr/lib64/apr-1/build/libtool --mode=install cp libphp5.la /usr/local/apache2/modules/
l    ibtool: install: cp .libs/libphp5.so /usr/local/apache2/modules/libphp5.so
libtool: install: cp .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/max/Desktop/localhost/php-5.3.6/libs'
chmod 755 /usr/local/apache2/modules/libphp5.so
[activating module `php5' in /usr/local/apache2/conf/httpd.conf]
Installing PHP CLI binary:        /usr/local/bin/
Installing PHP CLI man page:      /usr/local/man/man1/
Installing build environment:     /usr/local/lib/php/build/
Installing header files:          /usr/local/include/php/
Installing helper programs:       /usr/local/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/lib/php/
[PEAR] Archive_Tar    - already installed: 1.3.7
[PEAR] Console_Getopt - already installed: 1.3.0
[PEAR] Structures_Graph- already installed: 1.0.4
[PEAR] XML_Util       - already installed: 1.2.1
[PEAR] PEAR           - already installed: 1.9.2
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
/home/max/Desktop/localhost/php-5.3.6/build/shtool install -c ext/phar/phar.phar /usr/local/bin
ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar
Installing PDO headers:          /usr/local/include/php/ext/pdo/

I restarted the apache service and went to localhost to view a php file, and it didn't work (apache just indexes the .php files in the htdocs folder and lets me download them).

Any ideas?

2 Answers 2

1

Make sure, you have PHP included in the apache configuration file and that you have the correct handler set to it.

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
</IfModule>

Anyway: Are you sure, that you need Apache and PHP compiled from source? There are precompiled packages available for most Linux distributions and it's much easier to configure them.

4
  • I added that to my httpd.conf and I got this error when restarting the service: httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory
    – n0pe
    May 21, 2011 at 19:41
  • And OpenSuse does have packages from them but I wasn't sure on the defaults and they didn't show up in /usr/local
    – n0pe
    May 21, 2011 at 19:42
  • MaxMackie: If you search (find/local) your system, do you find a libphp5.so anywhere? Perhaps you need to rebuild PHP and tell it where to install the apache module, or copy the module from some other directory. The default OpenSuSE install directory is probably in /usr, not /usr/local May 21, 2011 at 20:39
  • My config was just an example. According to your output the correct path could be /usr/local/apache2/modules/libphp5.so May 22, 2011 at 13:58
0

If you're on a 64-bit OS (as it appears) you may be running into this bug which is due to different library paths for 64-bit files. There are two potential solutions listed at the end there:

  1. Run ./configure with desired options
  2. Edit ./libtool: add /usr/lib64 to sys_lib_search_path_spec AND sys_lib_dlsearch_path_spec
  3. Make/Install

or

  1. Use the bz2 PHP source download instead of the gz
1
  • Yeah I found those 2 fixes and they still didn't end up working.
    – n0pe
    May 22, 2011 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .