Current location: Hot Scripts Forums » Programming Languages » PHP » Recompiling PHP that was installed from RPM package?

Recompiling PHP that was installed from RPM package?

Reply
  #1  
Old 11-03-09, 10:34 PM
Kreshna's Avatar
Kreshna Kreshna is offline
New Member
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Recompiling PHP that was installed from RPM package?

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?
Reply With Quote
  #2  
Old 11-04-09, 05:18 PM
wirehopper's Avatar
wirehopper wirehopper is offline
Community Liaison
 
Join Date: Feb 2006
Posts: 1,560
Thanks: 2
Thanked 25 Times in 25 Posts
Before you recompile, see if you can just add the RPM - try yum install (RPM name) If it is a RedHat or CentOS server, adding the RPM may do it.

RPM resource php

There's probably more here than you need, but these are the steps I took. The RPM install may take care of it.

1. Configure firewall to allow httpd requests: system-config-securitylevel
2. Get PHP development RPM: RPM Search php-devel-5.1.6-20.el5.i386.rpm
3. Get PHP source RPM: ftp://ftp.pbone.net/mirror/ftp.cento...23.el5.src.rpm
4. Use yum to handle RPM dependencies. yum install php-5.1.6-23.el5.src.rpm 5. Update SPECS/php.spec and enable/disable options as necessary.
6. rpmbuild -bb –target=i386 SPECS/php.spec - It’s good to specify the target, since otherwise, the RPM build may take a very long time.
7. Force the installation of the updated RPMs. I did an ls of the RPMS directory and forced them all.
rpm -i –force php-5.1.6-23.i386.rpm php-bcmath-5.1.6-23.i386.rpm php-cli-5.1.6-23.i386.rpm php-common-5.1.6-23.i386.rpm php-dba-5.1.6-23.i386.rpm php-debuginfo-5.1.6-23.i386.rpm php-devel-5.1.6-23.i386.rpm php-gd-5.1.6-23.i386.rpm php-imap-5.1.6-23.i386.rpm php-ldap-5.1.6-23.i386.rpm php-mbstring-5.1.6-23.i386.rpm php-mysql-5.1.6-23.i386.rpm php-ncurses-5.1.6-23.i386.rpm php-odbc-5.1.6-23.i386.rpm php-pdo-5.1.6-23.i386.rpm php-pgsql-5.1.6-23.i386.rpm php-snmp-5.1.6-23.i386.rpm php-soap-5.1.6-23.i386.rpm php-xml-5.1.6-23.i386.rpm php-xmlrpc-5.1.6-23.i386.rpm
Reply With Quote
  #3  
Old 11-04-09, 09:15 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 2,836
Thanks: 13
Thanked 11 Times in 10 Posts
Reminds me of a joke....

It only takes three commands to install Gentoo:

cfdisk /dev/hda && mkfs.xfs /dev/hda1 && mount /dev/hda1 /mnt/gentoo/ && chroot /mnt/gentoo/ && env-update && . /etc/profile && emerge sync && cd /usr/portage && scripts/bootsrap.sh && emerge system && emerge vim && vi /etc/fstab && emerge gentoo-dev-sources && cd /usr/src/linux && make menuconfig && make install modules_install && emerge gnome mozilla-firefox openoffice && emerge grub && cp /boot/grub/grub.conf.sample /boot/grub/grub.conf && vi /boot/grub/grub.conf && grub && init 6

That's the first one.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data (scroll down)
Reply With Quote
  #4  
Old 11-13-09, 01:03 AM
Kreshna's Avatar
Kreshna Kreshna is offline
New Member
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by wirehopper View Post
Before you recompile, see if you can just add the RPM - try yum install (RPM name) If it is a RedHat or CentOS server,
Yes, it is a RedHat/CentOS server.
Quote:
Linux version 2.6.9-22.ELsmp (buildcentos@louisa.home.local) (gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)) #1 SMP Sat Oct 8 19:11:43 CDT 2005


Quote:
Originally Posted by wirehopper View Post
adding the RPM may do it.
You mean re-configuring the source RPM, rebuild the PHP RPM packages, and then install the newly-configured PHP RPM over the existing PHP? Am I correct here?

Sorry, I'm an RPM noob.



Quote:
Originally Posted by wirehopper View Post
Why do we need both development RPM and source RPM?



Quote:
Originally Posted by wirehopper View Post
4. Use yum to handle RPM dependencies. yum install php-5.1.6-23.el5.src.rpm
Well, the PHP come from the built-in Red Hat installer packages, and it's already up and running on a production server. Do I really need to handle RPM dependencies? And what if I skip this part?



Quote:
Originally Posted by wirehopper View Post
5. Update SPECS/php.spec and enable/disable options as necessary.
This is where the reconfiguration takes place, isn't this? So what I'm doing here is similar to what I'm doing with the ./configure command, isn't it?



Quote:
Originally Posted by wirehopper View Post
6. rpmbuild -bb –target=i386 SPECS/php.spec - It’s good to specify the target, since otherwise, the RPM build may take a very long time.
This is the name of the SPEC file I've just edited, right?



Quote:
Originally Posted by wirehopper View Post
7. Force the installation of the updated RPMs. I did an ls of the RPMS directory and forced them all.
Er, this is where I don't understand the most.



Quote:
Originally Posted by wirehopper View Post
rpm -i –force php-5.1.6-23.i386.rpm php-bcmath-5.1.6-23.i386.rpm php-cli-5.1.6-23.i386.rpm php-common-5.1.6-23.i386.rpm php-dba-5.1.6-23.i386.rpm php-debuginfo-5.1.6-23.i386.rpm php-devel-5.1.6-23.i386.rpm php-gd-5.1.6-23.i386.rpm php-imap-5.1.6-23.i386.rpm php-ldap-5.1.6-23.i386.rpm php-mbstring-5.1.6-23.i386.rpm php-mysql-5.1.6-23.i386.rpm php-ncurses-5.1.6-23.i386.rpm php-odbc-5.1.6-23.i386.rpm php-pdo-5.1.6-23.i386.rpm php-pgsql-5.1.6-23.i386.rpm php-snmp-5.1.6-23.i386.rpm php-soap-5.1.6-23.i386.rpm php-xml-5.1.6-23.i386.rpm php-xmlrpc-5.1.6-23.i386.rpm
So after Red Hat installed its built-in PHP, it would make all the following files above, am I correct? And I should update all of them with my re-configured RPM, right?

Last edited by Kreshna; 11-13-09 at 01:07 AM.
Reply With Quote
  #5  
Unread 11-22-09, 01:48 PM
wirehopper's Avatar
wirehopper wirehopper is offline
Community Liaison
 
Join Date: Feb 2006
Posts: 1,560
Thanks: 2
Thanked 25 Times in 25 Posts
Sorry it has taken me awhile to respond.

A coworker recently told me for RedHat/CentOS - you can just add the RPMs for options you need - such as mb_string.

I can't remember why you need both the development RPM and the source RPM. I don't rebuild PHP often. My approach was derived from various sources on the 'net. It is definitely a brute force approach. It probably takes longer and yields far more capability than you may need.

Yes it is the name of the SPEC file you just edited. I think the difference between ./configure and RPM build is that ./configure just does the compile and RPM build compiles and creates the RPMs. You can decide how you want to do it. I like using RPMs because that way, if I wanted to take the RPM and put it on a different server, it would be easy.

You do need to worry about dependencies or the build will fail. yum is really nice.

When it finishes, you should have a big collection of RPMs, the forced installation ensures they are loaded onto the server for use.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
Excel Reading, PHP On Windows zicon PHP 2 08-18-04 04:39 AM
php with Apache in windows eDevil PHP 3 08-08-04 01:03 AM
100 Web Templates & 10 PHP Scripts for sale! HostersUK.co.uk General Advertisements 0 01-10-04 01:31 AM
PHP Script Package Tex General Advertisements 10 01-08-04 09:11 PM


All times are GMT -5. The time now is 04:58 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)