mysql dies after backup restored to new server

I migrated my virtual domains from an old centos server to a new centos 5.3 server Linux 2.6.18-164.el5 on x86_64. The new server is a clean install from script. I restored the domains from a new backup of the old server domains. The users and web pages all transferred properly, but scripts using mysql are failing. (webcalendar, phpbb and one of the help desk scripts.) After a little diggind, it appears that all the old scripts fail when accessing mysql.

I created a new webcalendar in another domain, and it works correctly.

Is there a known issue with backups? Hopefully there is something simple I've missed.

thanks... Steve

Status: 
Closed (fixed)

Comments

I haven't seen this before .. backups should transfer mysql data and logins across just fine, unless you have manually changed mysql passwords outside of Virtualmin.

What error are you getting exactly?

Fixed....

On the old system Server Configuration / website options / PHP script execution mode was set to FCGId

On the new system, I had to change that to Apache mod_php (run as Apache's user)

scripts all work now with the setting change.

Hmm, that's odd .. unless the new system has a different PHP version installed, or different modules.

On the script web pages, I would get no error at all... just a blank screen

When tracing the php execution, it would hang whenever a db function call was made.

We can probably recreate the problem for you, but we had to get the production stuff back online ASAP so I just changed it all to apache mod_php to get it up.

perhaps apache was not running as the correct user?

My phpbb was a little messed up still. I had to set the .cache folder to 777 so that the program would run.

webcalendar ran fine when mod_apache was selected.

osticket runs fine with mod_apache

Sorry didn't do a rigorous troubleshooting, we were in a hurry to get it back online.

If you switch to mod_php mode, scripts will run as a different Unix user, and so may not be able to access directories that they were before (such as the cache folder).

That explains why the cache needed permissions changed, but doesn't explain the original problem that we had to fix by changing from FCGId to mod_php.

What is the standard you suggest we use - mod_php or FCGId? Now that they are working, I can try tweaking settings to get it right.

I recommend using fcgid , as it improves security by preventing scripts run by one domain from accessing files owned by another.

OK... I set up a new script in one of my virtual servers and it set up as mod_php by default, and it worked. When I switched it to FCGId it failed - blank screen when starting the script.

Template for domain is set to use FCGId, but it doesn't. I'm looking for a missing setting somewhere....

remember, this is a clean install on CentOS from install script.

Which PHP script were you trying to run ?

Does it log anything useful to ~/logs/error_log ?

I've been using webcalendar as a simple canary. It has installed a few times successfully, but now it gives this error when I attempt to install.

found http://prdownloads.sourceforge.net:80/sourceforge/webcalendar/WebCalenda... in cache ..

PHP module mysql is required ..

  Installing package php5-mysql ..
  Installing package(s) with command yum -y install php5-mysql ..

  Loaded plugins: fastestmirror
  Loading mirror speeds from cached hostfile
   * base: mirror.anl.gov
   * updates: centos.mirror.nac.net
   * addons: ftp.lug.udel.edu
   * extras: linux.mirrors.es.net
  Setting up Install Process
  Parsing package install arguments
  No package php5-mysql available.
  Nothing to do

  .. install complete.

Module is not available even after installation!

<- Return to list of scripts

If I change website settings back to mod_php it installs. looks like the php5-mysql is required for the FCGId but not available?

Does it help if you run yum install php-mysql from the command line first ?

What's odd is that Virtualmin should do this automatically ..

That's actually one of the first things I tried.

yum install php-mysql Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.cs.vt.edu * updates: centos.aol.com * addons: centos.aol.com * extras: centos.mirror.nac.net Setting up Install Process Parsing package install arguments Package php-mysql-5.1.6-23.2.el5_3.x86_64 already installed and latest version Nothing to do

Looks like a summary of repeatable symptoms are:

It appears that I cannot install the webcalendar script when website options are set to FCGId due to a missing php5-mysql, but I can install webcalendar when website options are set to mod_php.

Domains restored from backup were originally installed on a FCGId machine, and they get restored but do not work unless we change them to mod-php.

Other scripts show the same behavior: osticket & phpbb.

That's odd, as it indidcates that the php-mysql package is already installed, so MySQL support should be working already.

If you edit etc/php5/php.ini under the domain's home directory, is there a line like :

extension=mysql.so

Yes, extension=msql.so is in the php ini file.

Additional symptom.... this cgi file does not run in /cgi-bin .and gives a 500 Internal Server Error:

file: php5.cgi

!/bin/bash

PHPRC=$DOCUMENT_ROOT/../etc/php5 export PHPRC umask 022 SCRIPT_FILENAME=$PATH_TRANSLATED export SCRIPT_FILENAME exec /usr/bin/php-cgi

You can't run that cgi script directly .. it is used to run PHP scripts.

You should verify that the mysql.so module is being loaded properly. Try SSHing in as the domain owner user, and running :

export PHPRC=/home/domain/etc/php5
php-cgi -m

and post the output..

I'm messing up a lot recently. Thought that was one of the generic status utilities. Here's the results of the commands for domain & user bvwisp.net with domain settings to: Apache mod_php (run as Apache's user)

-sh-3.2$ export PHPRC=/home/bvwisp.net/etc/php5

-sh-3.2$ php-cgi -m

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so' - /usr/lib/php/modules/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/php/modules/dbase.so' - /usr/lib/php/modules/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/php/modules/gd.so' - /usr/lib/php/modules/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/php/modules/imap.so' - /usr/lib/php/modules/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/php/modules/ldap.so' - /usr/lib/php/modules/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/php/modules/mbstring.so' - /usr/lib/php/modules/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/php/modules/mysql.so' - /usr/lib/php/modules/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/php/modules/mysqli.so' - /usr/lib/php/modules/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/php/modules/odbc.so' - /usr/lib/php/modules/odbc.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/php/modules/pdo.so' - /usr/lib/php/modules/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/php/modules/pdo_mysql.so' - /usr/lib/php/modules/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/php/modules/pdo_odbc.so' - /usr/lib/php/modules/pdo_odbc.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/php/modules/pdo_pgsql.so' - /usr/lib/php/modules/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/php/modules/pdo_sqlite.so' - /usr/lib/php/modules/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/php/modules/pgsql.so' - /usr/lib/php/modules/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/php/modules/snmp.so' - /usr/lib/php/modules/snmp.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/php/modules/xmlrpc.so' - /usr/lib/php/modules/xmlrpc.so: cannot open shared object file: No such file or directory in Unknown on line 0 [PHP Modules] bz2 calendar ctype curl date exif ftp gettext gmp hash iconv libxml mime_magic openssl pcntl pcre posix pspell Reflection session shmop SimpleXML sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml zlib

[Zend Modules]

-sh-3.2$

Sounds like a bunch of files are missing .. what is the output from :

rpm -V php-mysql

if it reports missing files, try running :

rpm -e --nodeps php-mysql
yum install php-mysql

rpm -V php-mysql

executes but gives no output.

I ran the command as both domain owner and root, no output from either.

Should I create a login account for you?

This box is:

Operating system CentOS Linux 5.3 Webmin version 1.490
Virtualmin version 3.73 Pro Theme version 7.4
Time on server 14/Oct/2009 08:57 Kernel and CPU Linux 2.6.18-164.el5 on x86_64
Real memory 5.82 GB total, 1.27 GB used [Memory used] Virtual memory 5.81 GB total, 0 bytes used [Swap space used] Local disk space 1.32 TB total, 79.21 GB used [Disk space used]

Ok, thanks for the login .. I see the issue now. Your old system was 32-bit but the new is 64-bit, and PHP puts its modules in a different directory for different CPU types. And your domains' php.ini files were all referring to the 32-bit path.

The quick fix was to run :

cd /usr/lib
ln -s /usr/lib64/php .
/etc/init.d/httpd restart

try it now ..

Thanks.... you guys kick butt.

Automatically closed -- issue fixed for 2 weeks with no activity.