MySQL and PHP 5 upgrade guide

asmar

Verified User
Joined
Aug 29, 2005
Messages
102
Location
https://t.me/pump_upp
Hello forum,

I read every single post in the forum related with MySQL 5 and PHP 5 but simply none of them worked ok for Debian.

Upgrading MySQL 5 via the binaries is a simple job BUT making PHP 5 to work with it, is simply a nightmare.... most of the configure prefix are returning error.

Did anyone successfully upgrade MySQL and PHP to 5 version?
If yes, a public howto would be more than welcome!

Thanks a lot
 
I am experiencing the same problem. In my case I have three servers to upgrade - but I simply haven't been able to build PHP 5 succesfully with mysql 5 (on Debian 3.1 with DirectAdmin).
 
I've just succesfully compiled MySQL 5.0.22 and PHP 5.1.4 (both MySQL and MySQLi support).

Next step I'll install DirectAdmin and I'll try to do the same thing again.

Previous attempts were unsuccesfull (php 5.1.2 and 5.1.3, mysql 5.0.20 and 5.0.19)

Maybe there has been a bug fix - I'm unsure.

If I manage to get MySQL 5 and PHP5 running (on Debian with DA) I'll post back!
 
Hi Geeza,

I managed to install everything fine on 5 different boxes all running:

Debian Stable (Sarge)
MySQL 5.0.18
PHP 5.1.4

The problem initially was with MySQL greater than 5.0.18. It seems to be a bug (no idea what) and as soon as I download and install 5.0.18 then PHP is compiling fine!

I waste so many hours trying to work this PHP thing....

Hope this will help someone.

Cheers
 
Hi,

Thanx for the reply. Im going to try and install it tomorrow. Did you also try the latest snapshots of PHP and MySQL? If so, did you add a bug @ http://bugs.php.net/ ?

I'd love to see this tracked down...

Cheers
 
Re: Re: MySQL 5 and PHP 5 tutorials.

Solden said:
I know it's a bit later now, but your link is no longer working (forum doesn't exist). Do you know of that tutorial somewhere else, please?
Here's the updated link:http://michaellewismusic.com/forum/viewforum.php?f=144
Note: After using these tutorials to upgrade my system... The Debian system doesn't work with DA so it's adding php5 and Mysql 5 and doesn't use it... it still uses the DA system.
 
I also got it to work and created a few installation scripts (php5, mysql5 and apache 2).

I would gladly share them with you when they are 100% working (untested yet).
 
Absolutly... that would be awesome... I had everything but mail working and I ran out of time to mess with it, so I had to revert and use DA's default system :(
Geeza said:
I also got it to work and created a few installation scripts (php5, mysql5 and apache 2).

I would gladly share them with you when they are 100% working (untested yet).
 
Geeza said:
I also got it to work and created a few installation scripts (php5, mysql5 and apache 2).

I would gladly share them with you when they are 100% working (untested yet).
I'm willing to test them for you.
 
Ok, here goes. This is UNTESTED!!! My own version differs a bit (mine copies config file, adds log dir in /var/log and loads SSL files). I changed it a bit so it can be used more commonly. I'd love to test it, but can't do it right now. So if I did not make a typo - this should at least work on a clean installation.
Code:
#!/bin/bash
scriptdir=$PWD

#=====================================================================
# Use and edit this script as you please. 
# I do not take any responsibility if this script might hurt your system,
# so use it at your own risk!
# Set the following variables to your system needs (also used to
# upgrade versions.
#=====================================================================

# Version of mysql
version="mysql-5.0.24"

# Download URL
url="http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.24.tar.gz/from/http://ftp.snt.utwente.nl/pub/software/mysql/"

# tar.gz that is downloaded (only this file format is supported!!!!)
file="mysql-5.0.24.tar.gz"

# Directories to download and extract mysql
downloadDir="/var/downloads" 
installDir="/var/install"

# These are the options used to configure
options="--prefix=/usr/local/$version --localstatedir=/usr/local/$version --with-innodb --without-debug --with-tcp-port=3306 --with-mysqld-user=mysql --with-unix-socket-path=/tmp/mysql.sock --with-openssl"

# Global function (echo text bolded)
function echoBold()
{
	echo -e "\033[1m$1\033[0m"
}

# Load DirectAdmin setup.txt (clean install!)
if [ -s /usr/local/directadmin/scripts/setup.txt ];
then
	# Include the DirectAdmin setup details
	chmod 0755 /usr/local/directadmin/scripts/setup.txt
	. /usr/local/directadmin/scripts/setup.txt
	
	# Restore file priveledges
	chmod 0700 /usr/local/directadmin/scripts/setup.txt
else
	mysqluser="root"
	mysql="my password"
fi

# Enter a custom username or press enter to use the default
echoBold "- Enter MySQL username (with sufficient priveledges) [ie: $mysqluser]"
read input_mysql_user

if [ ! "$input_mysql_user" = "" ]
then
	mysqluser="$input_mysql_user"
fi

# Enter a custom password or press enter to use the default
echoBold "- Enter user password [ie: $mysql]"
read input_mysql

if [ ! "$input_mysql" = "" ]
then
	mysql="$input_mysql"
fi

# Begin
echoBold "- Installing version $version"

# Download ncurses (required)
apt-get update
apt-get install ncurses-dev

# Head to the download directory
if [ ! -d $downloadDir ]
	then
	echoBold "- Error, download directory does not exist"
	exit 0
	
	else
	cd $downloadDir
fi

# Check to see if the file is downloaded
if [ ! -s $file ]
	then
		echoBold "- Downloading from $url"
		wget $url
	else
		echoBold "- $file already downloaded"
fi

# Head to the install directory
if [ ! -d $installDir ]
	then
		echoBold "- Error install directory does not exist"
		exit 0
	
	else
		cd $installDir
fi

# Untar if necessary
if [ ! -d "$installDir/$version" ]
	then
		echoBold "- Unpacking $file"
	if [ ! -s "$downloadDir/$file" ]
		then
		echoBold "Error, $file isn't in $downloadDir"
		exit 0
	fi
	
	# File is downloaded
	tar -zxvf "$downloadDir/$file"
	
	else
		echoBold "- $file already unpacked"
fi

# Time to configure
if [ ! -d "$installDir/$version" ]
	then
		echoBold "Error, $installDir/$version dir does not exist"
		exit 0
	else
	
	# Move to installation directory
	cd $installDir/$version
	
	# Makefile present
	if [ -s $installDir/$version/Makefile ];
	then
		echoBold "- Clean previous install"
		make clean
	fi
	
	echoBold "- Ready to configure"
	./configure $options

	echoBold "- Make"
	make
	
	echoBold "- Make install"
	make install
fi

# Check if eventual directory is there
if [ ! -d "/usr/local/$version" ]
	then
		echoBold "Error, /usr/local/$version not found"
		exit 0
fi

# Done installing, create sym links
if [ -L /usr/local/mysql ]
	then
		# Remove symlink
		rm /usr/local/mysql
fi

# Create new symlink
echoBold "- Creating symlink /usr/local/$version /usr/local/mysql"
ln -s "/usr/local/$version" /usr/local/mysql

# Create symlink to data
if [ ! -L /usr/local/mysql/data ]
	then
		echoBold "- Creating symlink /home/mysql /usr/local/mysql/data"
		ln -s /home/mysql /usr/local/mysql/data
fi

# Restart MySQL - IMPORTANT - SLEEP AFTER STOP AND START
/etc/init.d/mysqld stop
sleep 10
/etc/init.d/mysqld start
sleep 5

echoBold "- Installation complete"

echoBold "- Try to do a check"
/usr/local/mysql/bin/mysqlcheck --check-upgrade --all-databases --auto-repair --user=$mysqluser --password=$mysql

echoBold "- Upgrade privileges tables"
/usr/local/mysql/bin/mysql_fix_privilege_tables --user=$mysqluser --password=$mysql

exit 0

Chmod 755 to execute.
 
Last edited:
This is the PHP install script (also UNTESTED!!!!!!!)

It uses a seperate file that contains the configure options.

Create the below configure_php file before executing this script!

Code:
#!/bin/bash
scriptdir=$PWD

#=====================================================================
# Use and edit this script as you please. 
# I do not take any responsibility if this sript might hurt your system.
# So use it at your own risk!
# Set the following variables to your system needs (also used to
# upgrade versions.
#=====================================================================

# Version of PHP
version="php-5.1.5"

# Download location
url="http://nl3.php.net/get/php-5.1.5.tar.gz/from/nl2.php.net/mirror"

# tar.gz that is downloaded (only this file format is supported!!!!)
file="php-5.1.5.tar.gz"

# Configure options, see configure_php file!!!
optionsfile="configure_php"

# Directories to download and extract PHP
downloadDir="/var/downloads"
installDir="/var/install"

# Global functions
function echoBold()
{
	echo -e "\033[1m$1\033[0m"
}

echoBold "- Downloading extra packages (required for this install)"
apt-get update
apt-get install libxml2-dev libmcrypt-dev libtidy-dev libcurl-dev libbz2-dev libdb4.3-dev libjpeg-dev libpng-dev libXpm-dev freetype2-dev libgd2-xpm-dev libmcrypt-dev libldap2-dev libmhash-dev libmm-dev libsnmp5-dev libxslt-dev bzip2


echoBold "- Check if download dir exists"
# Head to the download directory
if [ ! -d $downloadDir ]
	then
	echoBold "Error download directory does not exist"
	exit 0
	
	else
	cd $downloadDir
fi

# Check to see if the file is downloaded
if [ ! -s $file ]
	then
	echoBold "- Downloading from $url"
	wget $url
	else
	echoBold "- $file already downloaded"
fi

# Head to the install directory
if [ ! -d /install ]
	then
	echoBold "Error install directory does not exist"
	exit 0
	
	else
	cd /install
fi

# Untar if necessary
if [ ! -d "/install/$version" ]
	then
	echoBold "- Unpacking $file"
	if [ ! -s "$downloadDir/$file" ]
		then
		echoBold "Error, $file isn't in the $downloadDir dir"
		exit 0
	fi
	
	# File is downloaded
	tar -zxvf "$downloadDir/$file"
	else
	echoBold "- $file already unpacked"
fi


# Time to configure
if [ ! -d "$installDir/$version" ]
	then
	echoBold "Error, $installDir/$version dir does not exist"
	exit 0
	else
	
	# Move to installation directory
	cd $installDir/$version
	
	
	# Makefile present
	if [ -s $installDir/$version/Makefile ];
	then
		echoBold "- Clean previous install"
		make clean
	fi
	
	echoBold "- Ready to configure"
	if [ ! -s "$scriptdir/configure_php" ]
		then
		echoBold "Error, $scriptdir/configure_php does not exist"
		exit 0
	fi
	
	chmod 755 $scriptdir/config/configure_php
	$scriptdir/configure_php

	echoBold "- Make"
	make
	
	echoBold "- Make install"
	make install
fi

echoBold "- Installation complete, restarting Apache (HTTPD)"
/etc/init.d/httpd restart

exit 0

IMPORTANT!!! BELOW CONFIG SETUP REQUIRES APACHE 2!!!
Install MysQL and Apache 2 before you install PHP 5!

Code:
./configure \
--with-apxs2=/usr/sbin/apxs \
--enable-memory-limit \
--disable-rpath \
--with-regex=php \
--enable-memory-limit \
--with-layout=GNU \
--disable-pear \
--enable-calendar \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-track-vars \
--enable-trans-sid \
--enable-bcmath \
--with-bz2 \
--enable-dbx \
--with-iconv \
--enable-exif \
--enable-filepro \
--enable-ftp \
--with-gettext \
--with-mime-magic \
--with-pcre-regex \
--enable-soap \
--enable-sockets \
--enable-simplexml \
--with-libxml-dir=/usr \
--with-dom=/usr \
--with-xsl=/usr \
--with-sqlite \
--enable-sqlite-utf8 \
--enable-tokenizer \
--enable-yp \
--with-zlib \
--with-zlib-dir=/usr \
--with-openssl=/usr \
--disable-static \
--with-curl \
--with-curl-dir=/usr/local/lib \
--with-gd \
--with-gd-dir=/usr/local \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-tiff-dir=/usr \
--with-gettext \
--without-pgsql \
--with-mm \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-tidy \
--with-mcrypt \
--with-mhash \
 --enable-mbstring=all \
--with-snmp=shared \
--enable-ucd-snmp-hack \
--with-ttf \
--with-xmlrpc \
--enable-soap

Chmod 755 to execute the above script. Change the various variables to your need (like install , download dir etc).
 
I have not... It's not what I'm looking for... I'm trying to use DA with Debian's apt-get system.
 
What is Default User id and password for mysql?

hi: i have upgraded my test server to mysql 5.0.x
however, i need to run the script:
/usr/bin/mysql_fix_privilege_tables but it needs user id and password.

I do not want to reset the password lest it will fail other items if DA uses them somewhere else.

Is there a way in DA to find out MYSQL userid and reset password?
 
you can find the mysql password that DA uses in /usr/local/directadmin/conf/mysql.conf
 
Back
Top