[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Urgent - major points - I broke my Apache / PHP install

Posted on 2009-02-17
36
Medium Priority
?
468 Views
Last Modified: 2012-06-22
I have a rented, dedicated server running CentOS with Plesk.  

In a failed attempt to install a separate instance of PHP (CLI version) I have broken my web server.  I can administer the server using Plesk, this is still working.  However none of my sites (configured as vhosts) are working, even just plain HTML.

I can get around in Linux but I don't know enough to be able to correct this.  I suspect I have overwritten the httpd.conf, or something.

I desperately need to get the server working again as I have a number of commercial sites.

I "think" I now have PHP (CGI) installed in /usr/local and PHP (CLI) installed in /usr.  If it is a clue to the problem, I have a cron script which runs each night, this is failing with this error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/dbase.so' - /usr/lib/php4/dbase.so: cannot open shared object file: No such file or directory in Unknown on line 0

I am prepared to email root access details to anyone with suitable credentials to fix this and award max points, and a beer if you're in the UK.
0
Comment
Question by:Ross Edwards
  • 19
  • 15
  • +1
36 Comments
 
LVL 92

Expert Comment

by:objects
ID: 23665871
lets start with what you changed (or at least what u can remember)

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23665912
I downloaded build 4.4.9 of PHP to /downloads.

I have configured and installed it several times, and I must have overwritten something critical.  I have not knowingly changed anything in Apache settings or anywhere else for that matter.

When it was working, php -v would return PHP 4.3.9 (cgi) etc....

Then I did an install of PHP, configured as CLI only, to /usr/local.  After a reboot php -v returned PHP 4.4.9 (CLI) and my webserver stopped working.

I have since reinstalled PHP (CGI) to /usr/local, /usr/local/bin, /usr and now php -v says 4.4.9 (cgi).  But it is not serving PHP to a browser, or HTML for that matter.
0
 
LVL 92

Expert Comment

by:objects
ID: 23665936
do you have a backup of the server?  a restore may be the quickest fix.

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:Ross Edwards
ID: 23665966
I have a backup of the individual sites contents, but not the server.  Unfortunately a restore is not an option (yet).    - the support provided by the hosting company is poor and they are suggesting they just flatten and reinstall.  I am sure it can be made to work if someone competent and willing could troubleshoot it, unfortunately they are neither.
0
 
LVL 92

Expert Comment

by:objects
ID: 23665967
whats in /usr/lib/php4

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23665972
php_ioncube_loader_lin_4.3.so  php_ioncube_loader_lin_4.4.so
0
 
LVL 92

Expert Comment

by:objects
ID: 23665979
how much work would it be to redeploy the sites after a os reinstall?

problem with trying to manually fix is that if things have been deleted or overwritten then it can get tricky.

not saying it can't be fixed just sussing the fastest and safest path.

0
 
LVL 92

Expert Comment

by:objects
ID: 23665992
> php_ioncube_loader_lin_4.3.so  php_ioncube_loader_lin_4.4.so

my centos (2.6.9) box has:

domxml.so  gd.so  imap.so  mbstring.so  mysql.so  php_ioncube_loader_lin_4.3.so  php_ioncube_loader_lin_4.4.so  sqlite.so

which cron job is failing?

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666003
I see what you're saying - problem is two of my commercial sites are heavily customised, one has about 70GB of content, and every second it is offline they (and us) are losing money.  I am trying to avoid this route if possible.  Plus we are moving to a new host, but not for a few weeks, and I don't want to have to pay £000s to have it rebuilt because of my error.
0
 
LVL 92

Expert Comment

by:objects
ID: 23666006
whats the output from:

/usr/bin/php -v


0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666014
Maybe I missed something when i did ./configure...  There is a single cron job which backs up a number of MYSQL databases and emails them to me.  This is not a major deal to us but might point to the cause of the problem.
0
 
LVL 92

Expert Comment

by:objects
ID: 23666017
how did u reinstall php?
and what version did you reinstall?

and check the apache/php logs to see why its failing

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666032

/usr/bin/php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/dbase.so' - /usr/lib/php4/dbase.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/dom.so' - /usr/lib/php4/dom.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/gd.so' - /usr/lib/php4/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/imap.so' - /usr/lib/php4/imap.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/json.so' - /usr/lib/php4/json.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/ldap.so' - /usr/lib/php4/ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/mbstring.so' - /usr/lib/php4/mbstring.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/mysql.so' - /usr/lib/php4/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/mysqli.so' - /usr/lib/php4/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/pdo.so' - /usr/lib/php4/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/pdo_mysql.so' - /usr/lib/php4/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/pdo_pgsql.so' - /usr/lib/php4/pdo_pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/pdo_sqlite.so' - /usr/lib/php4/pdo_sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/pgsql.so' - /usr/lib/php4/pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/xmlreader.so' - /usr/lib/php4/xmlreader.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/xmlwriter.so' - /usr/lib/php4/xmlwriter.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/xsl.so' - /usr/lib/php4/xsl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php4/zip.so' - /usr/lib/php4/zip.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error:  [Zend Optimizer] Extension "Zend Optimizer" cannot be loaded twice in Unknown on line 0

Open in new window

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666042
I did ./configure like this:

./configure '--enable-cli' '--prefix=/usr/local' '--enable-inline-optimization' '--with-xml' '--enable-bcmath' '--with-openssl' '--with-zlib=/usr' '--enable-wddx' '--enable-ftp' '--enable-pcntl' '--enable-memory-limit' '--with-gettext' '--enable-sockets' '--with-pspell=shared,/usr' '--with-mysql=shared' '--enable-mbstring=all' '--with-pear'

followed by make and make install
0
 
LVL 92

Expert Comment

by:objects
ID: 23666106
> I have since reinstalled PHP (CGI) to /usr/local, /usr/local/bin, /usr and now php -v says 4.4.9 (cgi).

> I did ./configure like this:

was that the install that broke things, or the reinstall of PHP(CGI)

whats in the lib directory of the php directory in /usr/local?

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666121
I think it was the CLI install that broke it.


[root@edwarlv2 lib]# ls
libzzip-0.so.10       libzzip.a   libzzip.so           libzzipwrap-0.so.10.0.82  libzzipwrap.la  php      pkgconfig
libzzip-0.so.10.0.82  libzzip.la  libzzipwrap-0.so.10  libzzipwrap.a             libzzipwrap.so  php.ini
[root@edwarlv2 lib]#
0
 
LVL 92

Expert Comment

by:objects
ID: 23666160
yes the CLI install broke it, but I'm more interested in the subsequent reinstall and how that was done and where it installed files.

what does the following return

locate mysql.so

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666174

[root@edwarlv2 php-4.4.9]# locate mysql.so
warning: locate: warning: database /var/lib/slocate/slocate.db' is more than 8 days old
/opt/ruby/lib/ruby/site_ruby/1.8/i386-linux/mysql.so
/var/lib/mysql/mysql.sock
/usr/lib/python2.3/site-packages/_mysql.so
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
/usr/lib/php4/mysql.so
/usr/lib/dbd/libmysql.so
0
 
LVL 92

Expert Comment

by:objects
ID: 23666201
is there any package management on the box?  eg. yum?

0
 
LVL 92

Expert Comment

by:objects
ID: 23666207
whats this return:

ls -l /etc/php.ini
0
 
LVL 92

Expert Comment

by:objects
ID: 23666213
also: ls -l /etc/php.d

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666229
Yes I have yum.

 ls -l /etc/php.ini
lrwxrwxrwx  1 root root 27 Feb 15 22:21 /etc/php.ini -> /usr/local/Zend/etc/php.ini
[root@edwarlv2 php-4.4.9]#
 (this is the original PHP.ini file with a symbolic link, i think)

ls -l /etc/php.d
total 72
-rw-r--r--  1 root root 51 Jan  5 20:02 dbase.ini
-rw-r--r--  1 root root 47 Jan  5 20:02 dom.ini
-rw-r--r--  1 root root 45 Jan  5 20:02 gd.ini
-rw-r--r--  1 root root 49 Jan  5 20:02 imap.ini
-rw-r--r--  1 root root 49 Jan  5 20:02 json.ini
-rw-r--r--  1 root root 49 Jan  5 20:02 ldap.ini
-rw-r--r--  1 root root 57 Jan  5 20:02 mbstring.ini
-rw-r--r--  1 root root 53 Jan  5 20:02 mysqli.ini
-rw-r--r--  1 root root 51 Jan  5 20:02 mysql.ini
-rw-r--r--  1 root root 47 Jan  5 20:02 pdo.ini
-rw-r--r--  1 root root 59 Jan  5 20:02 pdo_mysql.ini
-rw-r--r--  1 root root 59 Jan  5 20:02 pdo_pgsql.ini
-rw-r--r--  1 root root 61 Jan  5 20:02 pdo_sqlite.ini
-rw-r--r--  1 root root 51 Jan  5 20:02 pgsql.ini
-rw-r--r--  1 root root 59 Jan  5 20:02 xmlreader.ini
-rw-r--r--  1 root root 59 Jan  5 20:02 xmlwriter.ini
-rw-r--r--  1 root root 47 Jan  5 20:02 xsl.ini
-rw-r--r--  1 root root 47 Jan  5 20:02 zip.ini
[root@edwarlv2 php-4.4.9]#
0
 
LVL 92

Expert Comment

by:objects
ID: 23666266
have you tried using yum to reinstall php?

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666271
Yes - it seems to install php 5.x which I don't think is supported on my version of CentOS.
0
 
LVL 92

Expert Comment

by:objects
ID: 23666282
> Yes - it seems to install php 5.x which I don't think is supported on my version of CentOS.

that suggests you are using the plus repo.
whats in /etc/yum.repos.d/Centos-base.repo

> I don't think is supported on my version of CentOS.

it should run ok, assuming you don't have any php4 specific code

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666384
How do I see what is in in /etc/yum.repos.d/Centos-base.repo

Just tried yum update php and it does nothing.  I am sure I ran this earlier.  It;s been a long night time for bed here - will be back in the morning UK time.  Thanks for your time so far.
0
 
LVL 92

Expert Comment

by:objects
ID: 23666391
cat /etc/yum.repos.d/Centos-base.repo

0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666403

 cat yum.repos.d/Centos-base.repo
cat: yum.repos.d/Centos-base.repo: No such file or directory
[root@edwarlv2 etc]# cd yum.repos.d
[root@edwarlv2 yum.repos.d]# ls
atomic.repo  CentOS-Base.repo  CentOS-Media.repo  plesk.repo
[root@edwarlv2 yum.repos.d]# cat CentOS-Base.repo
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
protect=1
 
#released updates
[update]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
protect=1
 
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
protect=1
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
protect=1
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=2
protect=1
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=2
protect=1

Open in new window

0
 
LVL 92

Accepted Solution

by:
objects earned 1500 total points
ID: 23666438
I think trying to do an complete php install from scratch using yum would be the way to go
perhaps removing it (using yum) first
0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23666450
I have just done a new install, manually as Yum not working for me now...

I think my problem might relate to an error in the php configure line.  I have reinstalled to /usr/bin howver if i do php-v it seems to be using the one in /usr/local/bin which  is misconfigured.

How can i tell the box to use the php install in /usr/bin, and how can i remove the other install?
0
 
LVL 92

Expert Comment

by:objects
ID: 23666460
check your path

0
 
LVL 92

Expert Comment

by:objects
ID: 23666465
what does the following now return:

/usr/bin/php -v

ls -l /usr/lib/php4

0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 23668907
>I have reinstalled to /usr/bin howver if i do php-v it seems to be using the one in /usr/local/bin which  is misconfigured.
>How can i tell the box to use the php install in /usr/bin, and how can i remove the other install?

if the executable's name is php

mv  /usr/local/bin/php  /usr/local/bin/php.bak

ln -s  /usr/bin/php  /usr/local/bin/php

this creates a symbolic link to the correct (sure?) one
0
 
LVL 11

Expert Comment

by:bansidhar
ID: 23669377
check if apache is getting loaded.
/sbin/service httpd status
and also try a restart of the apache server from command line, so you can get the error if any. If there is no error, check httpd.conf and the conf files in the conf.d to see which php the server is using. looks like you have overwritten the httpd.conf. If you have a good backup of this file just restore it. Be careful to have a backup on anything you are restoring.
0
 
LVL 1

Author Comment

by:Ross Edwards
ID: 23693811
I have resorted to rebuilding the server.  Thanks to all that have helped.  I will award the points to objects for rapid assistance and perseverence!
0
 
LVL 92

Expert Comment

by:objects
ID: 23696253
might be worth have a think about some measures to avoid these sort of problem in the future. Having a good deployment process can be really useful allowing you to easily install a site on a new box not only makes deployment easy but can save downtime in these types of situations.

0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month19 days, 20 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question