LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-11-2009, 09:11 PM   #1
dashrantic
LQ Newbie
 
Registered: May 2004
Location: Michigan USA
Distribution: Mandrake 10.0
Posts: 4

Rep: Reputation: 0
Switching PHP version on Apache2


Hi,

I have two versions of PHP on my server, and I need to switch which one is being used by Apache (Apache 2), but I'm unsure how. The first version of PHP was installed via apt-get, and the second version I am compiling from source. I want to use the version I am compiling from source, not the apt-get version.

I've got the new version of PHP configured, make-ed, and make install runs fine, just I don't know what I need to do to tell Apache to use the new version. Doesn't seem like it should be too difficult but I haven't been able to dig up anything very useful searching for this problem.

(As for why I need to switch, if anyone is wondering: it seems that the only way to get the full GD library is to have it compiled along with PHP--the php5-gd library from the package manager doesn't include everything.)

Thanks for any help!
 
Old 07-12-2009, 03:35 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

First of all, you cannot have 2 versions of php used by apache at the same time, unless you have the first compiled as a DSO and the second as a cgi. There are plenty of howtos on this if you're interested.

Now assuming that you've compiled your php as a DSO (using --with-apxs2), then you can copy the libphp5.so in the place where the other apache modules are, making a backup first of the libphp5.so that came with your distro and restart apache.
 
Old 07-14-2009, 10:23 AM   #3
dashrantic
LQ Newbie
 
Registered: May 2004
Location: Michigan USA
Distribution: Mandrake 10.0
Posts: 4

Original Poster
Rep: Reputation: 0
Hi, sorry for my late reply back here.

I don't want 2 PHP versions at the same time--I have one running, and I want to use another, and get rid of the first one I used to --with-apxs2 option when compiling PHP and everything seemed to work fine, but there seems to be an issue with libphp5.so? When I try to restart Apache, I get this error:


Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: undefined symbol: sapi_globals


I haven't been able to find much information on how to solve this, I don't know if I'm still missing a package or something, but how do I know which one? Any help with this would be greatly appreciated.

Thanks!


-----------------------------------------


Resolved! In case anyone else runs into this problem, turns out I needed to configure PHP with the "--with-pic" option in a *clean* php directory (I just unpacked the PHP zip again). Worked after that.

Also had to symlink httpd.conf to apache2.conf:
ln -s /etc/apache2/apache2.conf /etc/apache2/httpd.conf

Last edited by dashrantic; 07-14-2009 at 12:28 PM.
 
Old 03-25-2010, 01:34 AM   #4
omegas
LQ Newbie
 
Registered: Dec 2009
Posts: 3

Rep: Reputation: 0
Troubles with configuring php5

Hi dashrantic,

I am currently doing apache-1.3.39 with php5.2.9 and sqlite3.6.19 on arm linux and when I cross compiled them and put them on my arm board, I received the same error

Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: undefined symbol: sapi_globals

Then I used your method to solve it but it was not successful since I got errors when I configured php5.2.9 when I added --with-pic parameter. So I really hope that you can provide some valuable opinions to me.

1. According to your descriptions, did you install apache2 and php5 on pc or on arm board?
2. What and how many parameters should I add in the configure part of php5?
3. Did you know any good sites or links related to cross compiling or configure with php5 on arm linux?

Thousand thanks,
omegas
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2.0.52, t1lib-5.0.2, php-apache2-5.0.2 wizard7423 Slackware 2 04-04-2011 08:09 PM
Apache2 executes PHP files if specified, but not index.php will.fletcher Linux - Server 6 07-07-2009 09:27 PM
Suse 9.3/apache2/php4 - Firefox tries to download index.php, other *php pages work stefanlasiewski SUSE / openSUSE 1 01-18-2006 06:12 PM
Considering switching...which version? (with details!) Superion Linux - Newbie 22 11-20-2005 11:11 PM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 11:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration