yum -y install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-devel sqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel makeImportant: Before you go any further please read Upgrading Plesk from PSA_10.2.0 to PSA_10.3.0 I’m going to need the MySQL development libraries so install them next:
yum -y install mysql-develThe big surprise here was that it installed PHP 5.3 as a dependency! which I was not expecting, but everything still seems to be working! Now that we have the platform set up, we’ll download all the sources we need and unpack them.
- Create a folder for us to work in:
mkdir /home/mrn/dev/python cd /home/mrn/dev/python
- Go to the Python download page:
- Download and uncompress:
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tar.bz2 tar -xjvf Python-2.7.1.tar.bz2
- Go to the Python MySQL module page:
- Download and uncompress:
wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz tar -xzvf MySQL-python-1.2.3.tar.gz
- Download the Easy Installer set up:
- Go to Python folder:
- Check there is nothing already living in
/usr/local/python27because that is where we are going to install out copy of Python.
- Run the source configuration program:
- Start the build:
- Install (as root):
# /usr/local/python27/bin/python Python 2.7.1 (r271:86832, Jun 2 2011, 16:02:46) [GCC x.x.x xxxxxxxxx (xxxxx x.x.x-xx)] on xxxxx Type “help", “copyright", “credits” or “license” for more information.We must add python to our
PATHso that the next part will pick up our new python and not the old one.
# export PATH=/usr/local/python27/bin:$PATHAs a prerequisite for the Python MySQL’s module we need to install
setuptools. There is a really handy video on ShowMeDo here on how to do it. Don’t forget to run this as root (if you installed it as root) because it will modify the Python installation directory. The
importshould return without an error.
# cd .. # python ez_setup.pyTo test it, try to import setuptools.
# /usr/local/python27/bin/python Python 2.7.1 (r271:86832, Jun 2 2011, 16:02:46) [GCC x.x.x xxxxxxxxx (xxxxx x.x.x-xx)] on xxxxx Type “help", “copyright", “credits” or “license” for more information. >>> import setuptools >>>Compile the MySQL module Now that we have sorted out the Python installation go to the MySQL Python directory. The
site.pydefault file doesn’t need changing so we can use it as is. There is the option to change the MySQL Python module name from
_mysqlto something else but there’s not much point because every example you’ll find on the Internet has it as the default; you’ll spend the rest of your life searching and replacing! Again you’ll have to run this as root if you did earlier.
# cd MySQL-python-1.2.3 # python setup.py build # python setup.py installTo test it, try to import _mysql, it should return without an error.
# /usr/local/python27/bin/python Python 2.7.1 (r271:86832, Jun 2 2011, 16:02:46) [GCC x.x.x xxxxxxxxx (xxxxx x.x.x-xx)] on xxxxx Type “help", “copyright", “credits” or “license” for more information. >>> import setuptools >>>The first time I did this I got the following error message, but after I’d logged out and logged back in again the error message went away and I couldn’t reproduce it.
/usr/local/python27/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/local/python27/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg/_mysql.pyc, but /home/djn/dev/python/MySQL-python-1.2.3 is being added to sys.pathThe unexpected upgrade of PHP from version 5.1 to 5.3 threw up the following error message on all my
SYSTEM WARNING: date_default_timezone_get() [function.date-default-timezone-get]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Europe/London’ for ‘BST/1.0/DST’ insteadFixed it by adding the following line to
/etc/php.iniand restarting the web server.
date.timezone = ‘Europe/London’
Comment from: [Member]
The short answer is I don’t know! Just posted an article describing the problems that were caused by inadvertently updating PHP ( Upgrading Plesk from PSA_10.2.0 to PSA_10.3.0 ).
The trouble with Plesk is that it uses bastardised versions of the normal rpms that have been slightly modified to do the same job just in a Plesk way so when you are using yum (and presumably other package manager helpers) it doesn’t know about the Plesk dependencies or the Plesk layout.
The Plesk maintenance update made certain assumptions, that weren’t true after the PHP update and so it screwed the update process. I’ve used CPanel and Ensim before and they all have their own rpms so you may fall into the same trap.
My PHP was upgraded by yum trying to update the mysql-devel rpms but you could avoid this step by downloading the mysql-devel tarball and referencing it directly when compiling the MySQL-python.
If you have a development server then try it on that first. If, like me, you only have one server then back *everything* up before you start!
Form is loading...