我使用所有的默认configuration(简单的./configure,make,make install)在我的系统上安装了最新的apache web服务器。 然后我试图绑定PHP5,但我永远不能得到它的工作。
我做的第一件事就是试着让它适应这些设置:
./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
当我试图“安装”时,这给了我这个错误:
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
所以我厌倦了没有select的configuration(除了apxs2),并且能够进行安装。 这是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/
我重新启动了Apache服务,并去localhost查看一个PHP文件,并没有工作(Apache只索引htdocs文件夹中的.php文件,并让我下载它们)。
有任何想法吗?
确保你在Apacheconfiguration文件中包含了PHP,并且你已经为它设置了正确的处理程序。
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so <IfModule mod_php5.c> <FilesMatch "\.ph(p3?|tml)$"> SetHandler application/x-httpd-php </FilesMatch> </IfModule>
无论如何:你确定,你需要从源代码编译Apache和PHP吗? 预编译的软件包可用于大多数Linux发行版,configuration起来更容易。
如果你在一个64位的操作系统上(看来),你可能会遇到这个错误 ,这是由于64位文件的不同库path造成的。 最后列出了两种可能的解决scheme:
sys_lib_search_path_spec AND sys_lib_dlsearch_path_spec 要么