Featured Post

Upgrading SVN on Linux (CentOS)

The following series of events were carried out on CentOS 5 and were a success. If you are using a RedHat based systems such as CentOS or Fedora, the following series of instructions should allow you to upgrade svn in the same way. Please note you must investigate your own server settings and in no...

Read More

Upgrading SVN on Linux (CentOS)

Posted by Craig_Strong | Posted in Subversion | Posted on 09-07-2009

Tags: , , , , , , , , ,

3

The following series of events were carried out on CentOS 5 and were a success. If you are using a RedHat based systems such as CentOS or Fedora, the following series of instructions should allow you to upgrade svn in the same way.

Please note you must investigate your own server settings and in no way should you make any changes to your systems suggested here unless you are 100% confident that these changes will not result in problems to your system.

Recently I ran into a problem when using TortoiseSVN and the command line on CentOS. It appeared that after upgrading my version of tortoise I was being presented with errors on the command line when trying to run simple svn commands. Further investigation revealed that I was using an older version of svn on my server which was resulting in conflicts between my server and tortoise when quering the same repository. So I decided to record the procedure I went through to upgrade my version of svn and share it here. The most recent version of svn was which was 1.6 at the time of writing.

  1. Run ‘svn –version’ on the command line to confirm that you running an older version of svn than 1.6. In my case his revealed : ‘svn, version 1.4.6′. Upgrade needed.
  2. Check that YUM doesn’t have the version you require using the by running ‘YUM upgrade subversion’. In my case I received the response ‘No Packages marked for Update’.
  3. Make sure you have priorities installed by running ‘YUM install yum-priorities’
  4. Ensure that the priorities plugin is enabled by editing : ‘/etc/yum/plugincont.d/priorities.conf’. Then set ‘[main] enabled = 1′.
  5. Edit the .repo files in ‘/etc/yum.repos.d/*’ by adding ‘priority=N’ where N is 1 to 99 depending on your system.
  6. Priorities that I used :

    • Base, add-ons, updates, extras = 1
    • CentOS plus, contrib = 2
    • 3rd party repos such as RPMForge = N (Where N >=10)
  7. Download the RPM release package from : ‘http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
  8. Install DAGS GPG Key ‘rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
  9. Verify the package download by running ‘rpm -K rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
  10. If the package is verified, install the package ‘rpm -i rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
  11. Test that the package installed by running ‘yum check-update’. Look for ‘loading priority plugin’ and ‘excluded packages’ due to the priorities plugin being present.
  12. Add the following to the [base] and [update] sections of the centos.repo files in /etc/yum.repos.d/ (You may wish to add this to other 3rd party files in this directory as well):
      ‘exclude=subversion’.
  13. Now yum will behave as if there’s no package named subversion in the core repositories and will install the latest ’1.6′ from RpmForge.
  14. Run ‘yum install subversion’ and you should now see the latest subversion being installed. After which you can run ‘svn –version’ just to be sure.

Now you should have the latest version of subversion on your system.

Installing PHP5 on Leopard with pdo_mysql & iconv() support

Posted by Craig_Strong | Posted in Development | Posted on 03-04-2009

Tags: , , , , , ,

1

I recently took the plunge a level further into the Mac world and purchased an iMac running Leopard. Although I have been running a Macbook for years, I decided that my main machine which I develop on was going to be something I have to spend less time configuring than my previous Linux machines (Although my servers will remain Linux). My main goal was to get a slick dev environment running PHP, MySQL and Apache.

Being naïve, I expected Leopard to provide me with a suitable stable release of these technologies straight out of the box, after all Leopard comes with Apache, MySQL and PHP right? Well this maybe true, but this is not exactly what I expected. Soon after building my little world of development I realised that the distribution was insufficient. Disappointingly I learnt that the PHP distribution was missing ‘pdo_mysql’! How could they have missed this I asked myself? The extent of use of ‘pdo_mysql’ usage should have made this a fundamental module, even Zend Framework, one of the worlds largest PHP Frameworks uses this as a standard. Anyway this is the crossroads, do I recompile the distributed version and risk the Apple support or do I download and compile my own version. Well I thought, lets install it via macports, that will save me a bit of hassle. This also meant that I could maintain a separate series of installs to what came with leopard.

After downloading and installing macports I installed the following:

sudo port install php5 +apache2 +mysql5 +pear

port install jpeg

port install libpng

port install freetypeport

port install libmcrypt

After updating my apache configuration located ‘/opt/local/apache2/conf/httpd.conf/’ to suit my needs including pointing the my sites directory located in ‘Users/craigstrong/Sites’ I thought I’d give it a whirl on my web apps.

sudo apachectl restart

Everything seemed to work fine. I loaded up a few static pages from one of my Zend Framework projects, then I thought I’d try my login script. Boom! Guess what, no ‘pdo_mysql’ module installed. Arrggghhh!

Well off I went to get PHP 5.2.9 as this was the most stable recent release at the time. I convinced myself this is the solution I should had tried first. I downloaded this version and strapped myself in for a bit of compiling.

Within my extracted directory ~craigstrong/Programs/PHP-5.2.9 :

./configure
\
–prefix=/Users/craigstrong/Programs/php-5.2.9/
\
–with-apxs2=/opt/local/apache2/bin/apxs
\
–with-xsl=/usr’ \
–enable-mbstring
\
–with-gd’ \
–with-jpeg-dir=/opt/local 
\
–with-png-dir=/opt/local
\
–with-zlib-dir
\
–with-curl=/usr \
–enable-sockets \
–enable-exif
\
–with-mcrypt=/opt/local
\
–enable-soap
–with-mysql=/usr/local/mysql \
–with-pdo-mysql=/usr/local/mysql/bin/mysql_config
\
–with-mysql-sock=/tmp/mysql.sock
\
–with-freetype-dir=/opt/local
\
–with-openssl=/opt/local \
–enable-cli

The configuration went well, so I thought lets start compiling and run the following:

make

Followed by :

sudo make install
sudo mv /usr/bin/php /usr/bin/php.distro
sudo ln -s /Users/craigstrong/Programs/php-5.2.9/bin/php /usr/bin/php

All seemed to go well, and I went through my application again. This time when I go to the login form I was greeted with a new problem saying that the application could not find the function iconv(). Absolutely great I thought, another obstacle! After a bit of reading around this problem I found this link confirming my problem was real and what actually was attributed to a problem in the configure script on Leopard (http://www.mail-archive.com/php-bugs@lists.php.net/msg120323.html). I made sure to add the following 2 lines to the configure script pointing at my macports location.

–with-iconv=/opt/local
–with-openssl=/opt/local


As soon as I got to the ‘make’ command I was greeted with the following output:

Undefined symbols:
\\”_iconv_close\\”, referenced from:
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_decode in iconv.o
__php_iconv_mime_decode in iconv.o
__php_iconv_mime_decode in iconv.o
_zif_iconv_substr in iconv.o
_zif_iconv_substr in iconv.o
_php_iconv_stream_filter_dtor in iconv.o
_zif_iconv_mime_encode in iconv.o
_zif_iconv_mime_encode in iconv.o
\\”_iconv_open\\”, referenced from:
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_decode in iconv.o
__php_iconv_mime_decode in iconv.o
_zif_iconv_substr in iconv.o
_zif_iconv_substr in iconv.o
_zif_iconv_mime_encode in iconv.o
_zif_iconv_mime_encode in iconv.o
_php_iconv_stream_filter_factory_create in iconv.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

Well at this point I was getting more annoyed and again started cursing Apple for not sorting this out with the distribution of Leopard. Have to blame some one I thought.

Anyway after a long think a good time reading around the web I convinced myself to download php5.3 and go through the process again. I went through the same process of downloading, configuring and compiling it using exactly the same configuration script as above. I wasn’t expecting a high chance of success with the previous events. However to my amazement it worked. I went through my site and I finally achieved my goal of having PHP with ‘pdo_mysql’ and ‘iconv’ support! Although frustrating following the process, it was satisfying getting a result.

As I use Zend_Framework the only thing that needed to be resolved is that my date() function was throwing an error saying something on the lines of ‘best not trust the systems timezone’. I then added the following function to the bootstrap date_default_timezone_set(‘GTM’) and my problem was solved. I now have a development environment I can enjoy.

Useful Links Relating to this post :

  1. http://seancoates.com/php-5-2-5-on-leopard
  2. http://www.mail-archive.com/php-bugs@lists.php.net/msg120323.html
  3. http://drewish.com/node/110
  4. http://www.malisphoto.com/tips/php-on-os-x.html