I need to recompile an existing PHP installation, but the PHP was installed from RPM package. Is it possible to recompile such RPM-installed PHP? And if that's the case, what things should I anticipate? What potential problems I'm going to face? I'm quite familiar in compiling from scratch, but I have never re-compiled anything before. I'm also unfamiliar with RPM. Should I use the usual ./make and /make install command, or should I use RPM instead? Can RPM recompile things?
Yeah, it should be fine... When I do it, I leave the RPM installed version there and just put my compiled version in a different location. The default location for custom compiled versions is /usr/local/bin, so just make sure the RPM version isn't installed in there for some bizarre reason.
Thanks for the reply. But instead of modifying the existing RPM-installed version, you just compile a new instance of PHP and put it in different location, don't you? How to tell Apache to use the new PHP instance?
Yep... that's correct. You will need to edit your Apache config files to tell it where the new module is located (when you compile, it will tell you where it installed it to).
Thanks again, and glad to know I don't have to re-compile Apache. By the way, if the user already have existing Mambo/Joomla, this method won't distrupt the Mambo/Joomla, isn't it? Pardon the noob question but I'm unfamiliar with CMS. The reason I need to re-compile PHP is because I'm going to install MapServer PHPMapScript API on the production web server, but the server already has a running CMS-managed website.
The Mambo/Joomla site will be upgraded to your custom compiled version of PHP... you can't run two different versions of PHP on the same web server (well not easily anyway).
Thanks, digitalpoint, and you too, NatalicWolf. One last question though (I hope it will be the last): Intuitively (I said "intuitively" because I have never tried this before), I think compiling a "new instance" of PHP is much cleaner and safer than trying to overwrite your existing PHP installation. All you need to do is to change httpd.conf, restart Apache, and voila! Apache will use the newly installed PHP, and I will not break anything. And since this is production web server, I need to be very careful not to break anything. However, a friend of mine said that this method will likely overwrite a shared lib somewhere, that will break. Is that true? Considering the existing PHP doesn't even use MySQL, I guess nothing would break. What do you think?
Well of course the site uses mySQL! Judging from its appearance, it appears to use mambo or other CMS products, which naturally uses MySQL. Furthermore, a further look on the phpinfo.php shows MySQL-related entries: and Questions: (1) How can the existing PHP connect to MySQL despite the ./ switch clearly says "--without-mysql"? (2) If I install a "new instance" of PHP, what should I do to keep the connection to the existing MySQL, thus avoid breaking the existing website? (3) If I overwrite the existing PHP by rebuilding the RPM, will the "newly upgraded" PHP retain its MySQL connection? (4) Besides MySQL, what other things should I worry about? What other components usually depends on a typical PHP installation? And do those components were also installed by defaults, whether I installed a new instance of PHP or rebuilding the RPM? Actually, what I need to do is nothing more than adding "--with-pgsql" switch on the existing PHP. I never thought it'll be that complicated.