Ubuntu Lucid Lynx 10.4 LTS with PHP5.2 / CakePHP1.1, Ubuntu Lucid Lynx 10.4 LTS, and PHP5.3

Note: If you want to downgrade to PHP5.2 under Ubuntu Lucid 10.4 LTS just scroll down till the bottom of the post.

Hello! Last weekend I decided to upgrade my linux distro to the new ubuntu one, I was using a 2 years old ubuntu distro and after the launching of ubuntu 10.4 LTS with PHP 5.3 packages included, i thought it was a great chance for trying it and keep myself updated. But I forgot a little, but important, detail: I’m currently integrated in a project that consists in developing an huge information system based on CakePHP 1.1, it was the stable version of CakePHP when the development started, in that time CakePHP was in its 1.2RC2 release – it’s not of my buisness, but i find always myself wondering how cool it would be if that person had thought the development and maintenance would take some years, and the 1.2 would become stable.. 1.3.. and so on..
Anyway, let’s talk about what matters, i could not develop with CakePHP 1.1 under PHP 5.3, and i needed to make it work till Monday , i was left with 3 solutions:

  1. Fix the CakePHP 1.1 core for running under PHP 5.3
  2. Downgrade the PHP install for 5.2
  3. Setup a virtual machine as close as the deploying environment.

Well… in my mind the first one one was inconceivable, i dont have enough time to spent with what i’m not paid for in my spare times. About the second one…i didn’t want to downgrade, i wanted to make it only as fallback option. So i went ahead and started with the third solution.

So i downloaded and installed VirtualBox, downloaded a Debian Lenny small ISO image, created a new virtual machine with two virtual network adapters, the first one in the host-only mode, that means that the VM could not reach the outside network, only the hosting machine, that connection creates a loopback interface for the communicatio. The second adapter i setup with NAT mode, it allows you to reach the outside world through the hosting system giving the WM a virtual ip address. Why this network setup? Because we want to have access to the outside world, for software packages downloading, etc.. and we need to have access to our VM HTTP server, and through the loopback device ip address we can do it. During the debian install wizzard it asked me what kind of software did i want to install, i answered with an webserver direct answer! And it setup a system with apache. I installed PHP5 packages and it’s apache2 module more  the database one. I decided to leave the database and the document root filesystem in my physical system, since this app has some extremely heavy components with lots of queries and calculations in the database, so i configured my postgresql for accepting connections in my local virtual ip address, and configured my app for connecting to the virtual host machine ip address. Installed an SSH client in the VM, generated a DSA SSH key with ssh-keygen, and put it in my host machine authorized_keys with no command execution, port forwarding, X11 forwarding, and PTY allocation allowed. Setup an init script for mounting it using SSHFS in the document root, running it as www-data, edited the default apache’s VirtualHost and changed the DocumentRoot directive accordingly. Restarted all services and voilá! Opened my browser, typed it’s ip address and I had my wonderfull CakePHP 1.1 app running under ubuntu 10.4. I had my victory.

After some testing i realized that, as expected, it was a bit slow while handling a big bunchs of data. And I pondered to go through the third solution and removed all PHP5.3 packages from the system, and found this explaining a strategy to install Karmic packages in 10.4 to run PHP as CGI, I prefer PHP5.2 to run as an apache module, so everyting i did was this:


# remove all php packge
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
sudo su
# use karmik for php pakage
echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n"  >> /etc/apt/preferences.d/php
apt-cache search php5-|grep php5-|awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}' >> /etc/apt/preferences.d/php
apt-cache search -n libapache2-mod-php5 |awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}' >> /etc/apt/preferences.d/php
exit
# add karmik to source list
sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee -a /etc/apt/sources.list.d/karmic.list
# update package database (use apt-get if aptitude crash)
sudo apt-get update
# install php
sudo apt-get install -t karmic php5-cli libapache2-mod-php5

But i won’t give up of PHP5.3 anyway ;-)

EDIT: Quoting a comment from Pablo

A fourth solution could be install an older xampp package, which is isolated from “system’s” php packages and libs. xampp-linux-1.7.1 has php 5.2.9

Advertisements
    • Roel Veldhuizen
    • May 5th, 2010

    Great article! However ( yes there is always a however), the line ‘sudo apt-get install -t karmik php5-cli apache2-mod-php5’ can’t find apache2-mod-php5

  1. Hello. Thanks by notifying me! It was not appending the apache module to the file /etc/apt/preferences.d/php, i’ve corrected the command. It should be working now. Cheers.

    • Andrei
    • May 6th, 2010

    I have the same problem. The line with the line:sudo apt-get install -t karmik php5-cli apache2-mod-php5

    I still get the message: can’t find apache2-mod-php5

    Any ideas?

    • Hello, sorry, i confirmed and i typed incorrectly the package name, it should be libapache2-mod-php5 instead of apache2-mod-php5, just fixed the script again.
      Thanks by notifying this.

    • pedro
    • May 9th, 2010

    José…not working

    The following packages have unmet dependencies:
    libapache2-mod-php5: Depends: php5-common (= 5.2.10.dfsg.1-2ubuntu6) but 5.3.2-1ubuntu4 is to be installed
    E: Broken packages

    • Hi Pedro
      It wasn’t really generating the file /etc/apt/preferences.d/php correctly that’s why it could not find the package, i corrected and tested the script, it’s now working.

    • Peter
    • May 12th, 2010

    hi guys,

    It’s karmic, not karmic in the last line…

    greetz,
    Peter

  2. Great web development tutorial, I learned a lot, thanks.

  3. Dear sir,

    Your little tutorial on forcing php 5.2 on Lucid Lynx just saved my sorry ass. I owe you two internets.

    • Pablo
    • October 6th, 2010

    A fourth solution could be install an older xampp package, which is isolated from “system’s” php packages and libs. xampp-linux-1.7.1 has php 5.2.9

    Bye!

    • Jerome St. Sauver
    • February 21st, 2011

    Awesome, and much clearer than other similar posts I have found.

  4. public sector pension liabilities at a time when state and local governments have seen their revenues shrink drastically have resulted in an explosive backlash against public sector unions and the workers they represent.
    Thanks for Sharing..:)

    • Aver
    • October 3rd, 2011

    Invalid record in the preferences file /etc/apt/preferences.d/php, no Package header

  5. Thanks for do follow, I need more blogs, reply me if you know about that.

  6. 私が おすすめする 銀座のレーザー脱毛はコチラです

  7. Thanks for finally writing about >Ubuntu Lucid Lynx 10.4 LTS with PHP5.2 / CakePHP1.1, Ubuntu Lucid Lynx 10.4
    LTS, and PHP5.3 | web development in a nutshell <Loved it!

  8. ハロー。私は学生のころからダイエットをしょっちゅうしてました。体重は落ちてもすぐに戻ったりで結局たいして体重が落ちてません。ですが、この年齢になってくると昔よりも少ない食事でも太りやすくなってきたと感じています。そのため、今後は本気で減量をしようと決めたんです。しかもこれから暑くなってきます。ですからダイエットの本を見て調べたんです。どんなやり方のダイエット法があるのか、こんなやり方のダイエット法がおすすめとかの知識が増えました。最近は酵素を使ったスムージーのダイエットが主流の一つですね。美容も気にしながらダイエットできるようです。また、エステサロンなどで行われている痩身ですね。これも美を意識した痩せる方法ですね。その痩身エステにもサロンによっていろいろあって効果が期待できそうです。しかもほとんどのエステには体験コースというものがあって値段が安いので、まずは体験コースから行ってくださいね。。そして食べものも大事です。また、野菜野菜が嫌いなら野菜ジュースや果物ジュースなどでしっかりと栄養を摂ってダイエットしましょう。

  9. レーシックの手術を受けるか恐怖でなかなかなかなか踏ん切りがつかない、という相談をよく耳にします。現状、麻酔をしながらオペをするので痛みに襲われることはありません。リスクをしっかり把握してからココならば安心してできると納得する医療施設でオペレーションをすれば大丈夫だと思います。

  10. Right away I am going away to do my breakfast,
    later than having my breakfast coming yet again to read other news.

  11. Simply wish to say your article is as amazing.
    The clearness in your post is just great and i can assume you are
    an expert on this subject. Well with your permission let me to grab your RSS feed to keep up to date with forthcoming
    post. Thanks a million and please continue the enjoyable work.

  12. Hi there friends, how is everything, and what you desire to say regarding this post, in my view its actually awesome designed for me.

  13. コンタクトレンズならば目を大きく盛れて望みの顔を叶えたいオシャレに敏感な女の子を中心に人気が高いようですよ。
    人気女性芸能人プロデュースのプリティな瞳になれるカラーコンタクトレンズも選べるカラパラ007なら、グレー、イエローなどの色や度数、色直径やイットアイズ、Dope Winkドーブウィンクなどのブランドから探し出すことがきでて、かなりイチ押しとなっています。
    インターネットでスマートフォンやタブレット端末からお気に入りのコンタクトレンズを探し出して、希望すればその場で注文できる007速配コンタクは、豊富なアイテム満載でおすすめです。
    役立つ、そして有益な情報がございますよ。

  14. First of all I want to say awesome blog! I had a quick
    question that I’d like to ask if you don’t mind. I was curious to find out how you center
    yourself and clear your head before writing. I have had trouble clearing my mind in getting
    my thoughts out there. I do enjoy writing however it just seems like the first 10 to 15 minutes
    are generally lost just trying to figure out how to begin. Any ideas or tips?

    Thanks!

  15. Good post. I will be experiencing a few of these
    issues as well..

  16. なるほど。マカには色んな効き目があるんですね。参考になりました。ありがとうございました。

    ちなみにこのサイトでもとても勉強になったのでお勧めします。マカの効果が6つに手短にまとめられていたため、とてもわかりやすかったです。

    マカの効果だけじゃなく、選び方やサプリの比較データなどもあるのでマカ初めてという方にも向いていると思います。

    時間があれば是非一度見てみてください。損はしないと思いますよ。

  17. 拝見させていただきました。とても得るものが多かったです。有難うございます。育毛シャンプーについてボクも目一杯調べていましたが、ひとつ役に立ったサイトがありましたのでご紹介させてください。

    これです。育毛シャンプー好評13商品の口コミ。そのデータから見えてくるランキングなど、評価できるポイントはたくさんあります。ランキングは男性・女性に分かれているので性別に関係なくおすすめすることが出来ます。

    そんな育毛シャンプーの情報がてんこ盛りな当方のサイトは必見の価値ありだと思います。ぜひ一度各タイトルだけでも確認してみてください。

  18. At this moment I am going to do my breakfast,
    later than having my breakfast coming over again to read other news.

  19. I think what you published made a lot of sense. However, what about
    this? what if you were to create a awesome post title? I mean, I don’t wish to tell you how to run your
    blog, however what if you added a title to possibly grab folk’s attention?
    I mean Ubuntu Lucid Lynx 10.4 LTS with PHP5.2 / CakePHP1.1, Ubuntu Lucid Lynx 10.4 LTS, and PHP5.3 | web development in a nutshell is
    a little boring. You should look at Yahoo’s home
    page and watch how they create news headlines
    to grab people to open the links. You might add a video or
    a pic or two to grab readers interested about what you’ve got to say.
    In my opinion, it could make your posts a little bit more interesting.

  1. May 5th, 2010
  2. September 27th, 2016
    Trackback from : ecu circuits

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: