Portal Home > Knowledgebase > Articles Database > 2 copies of PHP installed, what to do?
2 copies of PHP installed, what to do?
Posted by ApplePro, 11-23-2007, 11:08 AM |
Hello,
I have a problem with Fedora linux server. I have two copies of PHP installed.
Now I have problems with modules, which are compiling with new version:
I've already removed all paths from bash and set only path to new version:
path=/usr/local/bin
Old version is in /usr/bin/
When I do phpinfo() after this change, I get old version info...
I wonder what should I do? Will removing both PHP and installing newest version will be a good idea or I can get more trouble?
Or maybe there is another way to fix it?
|
Posted by Srv24x7, 11-23-2007, 11:23 AM |
Hi
It will be a good idea to install the new version of php as the older verion php4 will not have any updates or support. So keeping two php with different versions will be a big ask.
|
Posted by ApplePro, 11-23-2007, 11:26 AM |
I can see two version, 5.1.6 in /usr/bin and 5.2.3 in /usr/local/bin. Do you mean I have 3rd version (php4) somewhere else?
Should I uninstall old versions? How?
|
Posted by creaws, 11-23-2007, 12:44 PM |
If you are going to use only one, remove the other, and if you are getting troubles to only remove the one you dont want to use, remove both and install a new one.
Did you installed them by source or rpm ?
|
Posted by ApplePro, 11-23-2007, 01:01 PM |
I need only latest one. But how can I remove it?
I can see only two installed.
I guess 5.1.6 was installed with the system. I runned "yum info php" and it said about 5.1.6. I removed it with "yum remove php". But I still see 5.1.6 in phpinfo().
I've installed 5.2.3 from the source.
|
Posted by creaws, 11-23-2007, 01:10 PM |
Type:
rpm -qa | grep php
and see if you get 5.1.6 packages. If you see them, delete with:
rpm -e the_name_of_the_package
That should be done with all php rpms (php-devel, php-gd, etc)
Just to be curious, do you have any control panel installed ?
Last edited by creaws; 11-23-2007 at 01:12 PM.
Reason: forgot a question
|
Posted by bryonhost1, 11-23-2007, 01:18 PM |
Hi!
Yes..my first question exactly. Cpanel still uses php4..but you can install php5 plugin using easyapache script in /scripts.
The reason the old version of php still shows in your webserver..updating php requires a recompile of apache as well.
There may be a different way of doing it..but that's the way I've always done it..by following the instructions provided.
Bryon
|
Posted by ApplePro, 11-23-2007, 03:24 PM |
Thanks. I've deleted all packages. But nothing works now. For example, when I run phpinfo, browser displays .php files just as text and doesn't execute them.
I've downloaded latest PHP and running these commands:
But website still doesn't work.
When I run php -v it displays PHP 5.2.5 installed (latest one).
Also, the strange thing is when I run php -i, it displays empty "./configure":
I wonder why doesn't it work?
PS: I have Webmin control panel installed.
Last edited by ApplePro; 11-23-2007 at 03:32 PM.
|
Posted by ApplePro, 11-23-2007, 03:26 PM |
I wonder what is the easiest way to do it (what instructions did you talk about)? Apache is working perfectly right now and I'd like to keep all settings.
|
Posted by bryonhost1, 11-23-2007, 10:36 PM |
Hi!
The php instructions...Install instructions that come with php. Hmmm. Webmin.
Good gravy..so you have a 64 bit os? I've never seen that many instructions given to php.
Hmmm..well...if that is phpinfo being run from the browser..then 5.25 is being used by the webserver. The next logical question would be:
>>What website are you trying to run? What specific application/script?
Bryon
Last edited by bryonhost1; 11-23-2007 at 10:40 PM.
|
Posted by ApplePro, 11-24-2007, 05:11 AM |
No, phpinfo runned not from browser, but from terminal:
php -i
Yes.
The main is one that turns on Apache support. But it sems something doesn't work.
Last edited by ApplePro; 11-24-2007 at 05:19 AM.
|
Posted by ApplePro, 11-24-2007, 06:57 AM |
It's strange.
When I install 5.1.6 with yum, it works fine with apache. When I run phpinfo in browser, I get this configuration:
Then I remove it with yum. Then I copy/paste this configuration and install 5.2.5 from source.
But it doesn't work with Apache (works from cli). It's looks really strange for me. I mean Apache works, PHP installed with yum works, but PHP 5.2.5 with the same configuration doesn't work.
How to fix it?
|
Posted by bryonhost1, 11-24-2007, 01:07 PM |
Hi!
I don't install php, mysql, perl, python, apache or anything fancy with yum. Period.
Hmmm. Doesn't work? Ok..let's go at it this direction: Where did this configuration file come from? Have you tried just a basic compile? Without all this fancy stuff?
Bryon
Last edited by bryonhost1; 11-24-2007 at 01:11 PM.
|
Posted by ApplePro, 11-24-2007, 02:04 PM |
The second one is generated by yum. What simple configuration is? Just ./configure with one option --with-apxs2=/usr/sbin/apxs?
|
Posted by bryonhost1, 11-24-2007, 02:31 PM |
Hi!
Well..I'd have to throw in --with-mysql even in the most basic compiles.
I believe upgrading php without webmin's knowledge should be no problem..I think it uses mostly (all?) perl.
Bryon
|
Posted by ApplePro, 11-24-2007, 04:05 PM |
I've tried to configure with these settings (simple ./configure doesn't install):
./configure --with-apxs2=/usr/sbin/apxs --with-zlib
But it doesn't work.
|
Posted by bryonhost1, 11-24-2007, 04:34 PM |
Hi!
Ok..it probably worked..but webmin has different locations for apache..therefore..you replaced nothing.
My workaround is simple. Leave webmin's version of apache alone.
You will find it's httpd.conf here:
/etc/httpd/conf/httpd.conf
Webservers get real ticked if you ask them to listen to no specific ports..so I have webmin's version listen to port 81.
>>>Whatever port you told webmin to listen to still works as normal as well.
I just went with the default..so it works fine.
I have configed our production server as normal..and installs..by default..in /usr/local/apache2
I've never spent a lot of time getting the script to work in
/etc/init.d to start multiple servers..so I just run ./apachectl directly..from /usr/local/apache2/bin and it works fine.
>>>Witness:
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 init [3]
5638 ? Ss 0:00 syslogd -m 0
5649 ? Ss 0:00 /usr/sbin/sshd
5662 ? Ss 0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
5680 ? Ss 0:00 sendmail: accepting connections
5689 ? Ss 0:00 sendmail: Queue runner@01:00:00 for /var/spool/client
5717 ? Ss 0:00 crond
20280 ? Ssl 0:00 /usr/sbin/named -u named
21864 ? Ss 0:00 /usr/bin/perl /webmin-1.380/miniserv.pl /etc/webmin/m
26514 ? Rs 0:00 sshd: root@pts/0
26520 pts/0 Ss 0:00 -bash
27855 ? Ss 0:00 /usr/sbin/httpd
27858 ? S 0:00 /usr/sbin/httpd
27859 ? S 0:00 /usr/sbin/httpd
27860 ? S 0:00 /usr/sbin/httpd
27861 ? S 0:00 /usr/sbin/httpd
27862 ? S 0:00 /usr/sbin/httpd
27863 ? S 0:00 /usr/sbin/httpd
27864 ? S 0:00 /usr/sbin/httpd
27865 ? S 0:00 /usr/sbin/httpd
28076 ? Ss 0:00 /usr/local/apache2/bin/httpd -k start
28077 ? S 0:00 /usr/local/apache2/bin/httpd -k start
28078 ? S 0:00 /usr/local/apache2/bin/httpd -k start
28080 ? S 0:00 /usr/local/apache2/bin/httpd -k start
28081 ? S 0:00 /usr/local/apache2/bin/httpd -k start
28082 ? S 0:00 /usr/local/apache2/bin/httpd -k start
28090 pts/0 R+ 0:00 ps ax
>>>>
I may fix it later..matters little. Ok..we now have the production server listening to port 80 in the default locations.
I'll go about recompiling php now.
Bryon
|
Posted by bryonhost1, 11-24-2007, 05:57 PM |
Hi!
I've also decided a alternate path as well. Let's try upgrading the version of apache that webmin uses.
Bryon
|
Posted by ApplePro, 11-25-2007, 09:21 AM |
The problem is really wa with apache. I've deleted apahce config file and uploaded again and now it works.
Thanks so much for idea and for help. I am really aprecciated.
|
Add to Favourites Print this Article
Also Read