安装php 5.2.17问题后,在ubuntu 11.10上安装apache2

Recently I immigrate to Ubuntu and everything was going good to I configuring and compiling PHP 5.2.17 on Ubuntu before I install apache2.

Now when I try install apache2 it installs successfully but unfortunately during start apache2 I get this error:

[crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
Pre-configuration failed
Action 'configtest' failed.

Any ideas for fixing this issue?

  • Try deleting all the apache2 folders from /etc/ and /var/ folders. Then remove apache and its dependencies

    sudo apt-get --purge remove apache2 apache2-mpm-prefork apache2-utils apache2.2-common

  • Then try installing apache again:

    sudo apt-get install apache2

    check the 127.0.0.1 to get "It works!" message ;) or check apache status by

    service apache2 status

  • now go with recompiling php 5.2.17 with fast-cgi enabled using this (edit it as you wish, this is mine) configurations options:

    ./configure --prefix=/usr/local/php-5.1.6 --with-config-file-path=/etc/php-5.1.6 --disable-ipv6 --with-zlib --enable-bcmath --with-bz2 --with-curl --enable-exif --enable-ftp --with-gd --with-ttf --enable-gd-native-ttf --with-imap-ssl --enable-mbstring --with-mhash --with-mysql --with-mysqli --enable-pcntl --with-pdo-mysql --with-pdo-sqlite --enable-shmop --enable-soap --enable-sockets --enable-sqlite-utf8 --with-xmlrpc --with-xsl --with-pear --enable-fastcgi

  • and then make & make install it. That should do the work

If you compiled PHP before compiling Apache, that might be where your problem is. Could you post your config.nice files from both PHP and Apache? That might give a better idea of where your problem is.

-EDIT- Usually, when compiling PHP with Apache, you have to use the --with-apache flag, or --with-apxs, which is part of Apache. That might be a good place to look.

Everything you need about installing Apache2+PHP: http://www.php.net/manual/en/install.unix.apache2.php

Core options: http://php.net/manual/en/configure.about.php

And, finally, why don't you use deb packages?