Installing Doctrine2 using PEAR

I was having a some sort of hell trying to install Doctrine via PEAR lately.
$sudo pear channel-discover
$sudo pear install -o

Was giving me errors like:
Package "" dependency "" has no releases
Package "" dependency "" has no releases
doctrine/DoctrineORM requires package "" (version >= 2.0.0)
doctrine/DoctrineORM requires package "" (version >= 2.0.0), installed version is 1.0.6
doctrine/DoctrineDBAL requires package "" (version >= 2.0.0)
No valid packages found
install failed

See, for some unknown reason the versions are not correct for the dependencies. Tried the solutions as stated in this StackOverflow topic for updating PEAR, but didn’t help!

Tried to remove/purge pear. But it didn’t help. Tried to install the Console, Yaml etc separately, also didn’t help.

Then when I tried to purge pear again I got the following error:

Removing php-pear …
Purging configuration files for php-pear ...
dpkg: warning: while removing php-pear, directory '/usr/share/doc/php5-common/PEAR' not empty so not removed
dpkg: warning: while removing php-pear, directory '/usr/share/php/.channels' not empty so not removed

There were some other folders which was reported to be not empty:

So, I removed them all!

Now, I again installed pear.

sudo apt-get install php-pear
Fingers crossed…

Added Doctrine channel: sudo pear channel-discover
And it didn’t say this time that channel is already in registry. Smiling…

Now to fire up doctrine installation, hope this time it works…
sudo pear install -o

et viola! it did!
Attempting to discover channel ""...
downloading channel.xml ...
Starting to download channel.xml (811 bytes)
....done: 811 bytes
Auto-discovered channel "", alias "symfony2", adding to registry
downloading DoctrineORM-2.3.0.tgz ...
Starting to download DoctrineORM-2.3.0.tgz (260,644 bytes)
...done: 260,644 bytes
downloading DoctrineCommon-2.3.0.tgz ...
Starting to download DoctrineCommon-2.3.0.tgz (59,473 bytes)
...done: 59,473 bytes
downloading DoctrineDBAL-2.3.0.tgz ...
Starting to download DoctrineDBAL-2.3.0.tgz (143,996 bytes)
...done: 143,996 bytes
downloading Console-2.1.3.tgz ...
Starting to download Console-2.1.3.tgz (51,354 bytes)
...done: 51,354 bytes
downloading Yaml-2.1.3.tgz ...
Starting to download Yaml-2.1.3.tgz (38,573 bytes)
...done: 38,573 bytes
install ok: channel://
install ok: channel://
install ok: channel://
install ok: channel://
install ok: channel://

Now lets test.
sudo pear list -c

Results in:
Installed packages, channel
Package Version State
DoctrineCommon 2.3.0 stable
DoctrineDBAL 2.3.0 stable
DoctrineORM 2.3.0 stable

Now, try doctrine at terminal:
lenin@office:/usr/share/php/.channels$ doctrine
Doctrine Command Line Interface version 2.3.0

 [options] command [arguments]
 --help -h Display this help message.
 --quiet -q Do not output any message.
 --verbose -v Increase verbosity of messages.
 --version -V Display this application version.
 --ansi Force ANSI output.
 --no-ansi Disable ANSI output.
 --no-interaction -n Do not ask any interactive question.
Available commands:
 help Displays help for a command
 list Lists commands
 dbal:import Import SQL file(s) directly to Database.
 dbal:run-sql Executes arbitrary SQL directly from the command line.
 orm:clear-cache:metadata Clear all metadata cache of the various cache drivers.
 orm:clear-cache:query Clear all query cache of the various cache drivers.
 orm:clear-cache:result Clear all result cache of the various cache drivers.
 orm:convert-d1-schema Converts Doctrine 1.X schema into a Doctrine 2.X schema.
 orm:convert-mapping Convert mapping information between supported formats.
 orm:ensure-production-settings Verify that Doctrine is properly configured for a production environment.
 orm:generate-entities Generate entity classes and method stubs from your mapping information.
 orm:generate-proxies Generates proxy classes for entity classes.
 orm:generate-repositories Generate repository classes from your mapping information.
 orm:info Show basic information about all mapped entities
 orm:run-dql Executes arbitrary DQL directly from the command line.
 orm:schema-tool:create Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output.
 orm:schema-tool:drop Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output.
 orm:schema-tool:update Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata.
 orm:validate-schema Validate the mapping files.

So, thats it.

Advertisements | The most friendly job portal of Bangladesh

Its been a while I was not writing any posts to this blog. I am here today to talk about the Job Poral we are working with for quite a while. You may know that ittefaq being the pioneering Daily of Bangladesh has been the prime source of job advertisements in the past. But it was not up-to-date with the technology advancement of this modern times. Ittefaq decided to go for the online presence and its overhauling their main portal as well. We (Bullseyelogic) are partnered with Ittefaq Group of Publications to develop and look after their job portal. As the CTO and Project manager of my team I can tell that my boys have done a great job and we can bravely proclaim its been a great pleasure to work on this project. And the features are pretty attractive compared to any other job poratals in Bangladesh.

Our site is hosted at the wonderful RackspaceCloud. And we have developed it using the Codeigniter Framework.

I’ll present here some of the videos I have made for the ease of our visitors. After watching these videos you’ll definitely like to sign up to our site. And take the opportunity to be with the promising job portal.

Watch the above to get a primer about the Employer registration and Control Panel.

Job Seeker view.

Watch the primer for the interactive CV-Builder.


Follow Ittefaq jobs on twitter & Facebook

My Immediate feelings after the ZCE exam

I cant help to share the feelings right away with you now. Just came back after we finished the exam.

Its great event of joy for me and my friend Abdullah. Because we sat together on the same day. And I think this is first ever in Bangladesh that two ZCE passed at the same day. To tell you the truth, I had an attempt on 19th February this year but that was kind of rushed sitting and thats why duely failed yet was very close to passing score 😦

But the question is why I decided to go for ZCE anyway? well first and foremost is the inspiration from Hasin Hayder, who is entitled among the BD PHP community as the pioneer and guru and the Geek on PHP. Though I started learning php on 2003, I was not very strong at it until last year. But Hasin bro kept inspiring that, you can become one and you should give it a good try. On that time we (Ferdous [9th ZCE] and me) were beginner level developer at the Saifur’s corporate and started a training on PHP. Most amazingly Hasin bro inspired us making the syllabus one of the best in Bangladesh. We included so many things in it. And we taught the students the best practices in development, design and DB etc. We introduced them with the common CMSs, Forums and even Frameworks. We introduced them PHP and jQuery frameworks too!

One of our students was Sadiqur Rahman(the wonder boy and 8th ZCE!), who enrolled there saying he wants to become a ZCE! 😀

So, it was our challenge from then on. Building our bases to achieve good better best practices in the PHP development industry. We inspired all students to become bloggers, tweeterers and getting fed from the best resources on the web on what they want to excell.

Even this morning at 5am when Hasin bro asked how is the preparation? I said not upto my intentions. He said some inspiring words that I calmed myself little bit. While taking the exam I was semi nervous. Kind of knew I’m winning it, but didn’t make the mistake what I did last time(I submittend the exam in 57 minutes and reviewed only 3 questions and came out 33minutes ago). Today I almost reviewed all 70 of them and started counting. Was little nervous… but when the count reached more than 61! I stopped 😀 and submitted it! et voila I got congratulations from

I kind of knew my friend Abdullah(he had an attempt last month and did score near to passing as well!) who started just 40 minutes after me was gonna pass as well, so it was a great feeling indeed.

Hope you guys didn’t mind this long writing. I just want to inspire new comers to PHP. We in Bangladesh should rise up and give it a good try. We need to outsource more of our intellect. We need to have our stand and we need to build a Very Best community. We need to do campaigns like WordCamp, ZendCon, PHPCon and inspire our fellow developers to become ninjas and beat the rest of the world.

I would like to share with you my old blog writing in Bangla you’d notice I wanted to see my name there very much(at least on 10th but oh well I made a milestone by sitting together two old friends together and won it) 😉  here’s the link:

Originally posted at

PHP শেখার সহজ উপায়গুলো জেনে নিন

অনেকেই অনেক দিন ধরে পিএইচপি বই নিয়ে গুতোগুতি এদিক ওদিক দৌড়িয়েছেন। কিন্তু পিএইচপি শেখা আর হয়ে উঠছে না, তাইনা?

আপনাদের চিন্তা মাত করতে এবার দিচ্ছি বেশ কিছু টিউটোরিয়ালের ঠিকানা।

একটা ব্যাপার মনে রাখতে হবে। কম্পিউটারের যেকোনো ভাষা শেখার সাথে সাথে তা অনুশীলন বাধ্যতামূলক। শেখার সময় সহজ মনে হলেও তা ফলিত আকারে নিজে অনুশীলন না করলে মনে থাকবে না এবং আয়ত্তে আসবে না।

আসুন কয়েকটি ঠিকানা থেকে জেনে নেই কী করে তাড়াতাড়ি পিএইচপি শেখা যাবে

‌১. ভিডিও
Click This Link

শেষের লিঙ্কটিতে দুনিয়ার আরো অনেক কিছু পাবেন টিউটোরিয়াল হিসেবে।

২. এটাই পিএইচপি’র বাড়ী এখান থেকে ম্যানুয়ালটি নামিয়ে নিন। আর এর বেসিক, মিডলেভেল বা এডভান্সড সব তথ্যাদি এখানেই পাবেন।

৩. যারা পিএইচপি নিয়মিত অনুশীলন করছেন তাদের এটা বেশ কাজে লাগতে পারে
এটি হচ্ছে পিএইচপি ম্যানুয়ালের উইজেট।

আরো অনেক অনেক লিঙ্ক আছে… কিন্তু সব আপনার দরকার নেই.. আগে শুরু করে দিন পরে নিজেই খুঁজে নিতে পারবেন।

ওহ হ্যাঁ ইংরেজী শেখা কিন্তু বাধ্যতামূলক.. তা’নাহলে কাচাই থেকে যাবেন যেকোনো প্রোগ্রামিংএ। আর Wrox বা অন্য প্রকাশনীর একটি অন্তত বই হাতের কাছে সবসময়।

পুনশ্চ: নেটে পাওয়া লিঙ্কগুলো নেটেই বুকমার্ক করে রাখুন। টুইটার বা ফ্রেন্ডফীড ব্যবহার করে। ফেসবুকেও লিঙ্ক শেয়ার করতে পারেন। বর্তমানে প্রসিদ্ধ এবং প্রতিষ্ঠিত প্রোগ্রামারদের ব্লগ পড়ুন। নিজেও যা কিছু শিখবেন ব্লগ করে ফেলুন(কপি/পেস্ট করে নয়, মৌলিক লিখে)। জ্ঞান ছড়ালে বাড়ে :

সবার জন্য বিশেষ প্রয়োজনীয় আর্টিকেলস
এই মাত্র পেলাম PHPArch মে ২০০৯ সংখ্যাটি ফ্রি দিচ্ছে ওরা তাড়াতাড়ি সংগ্রহ করে নিন। :)


From the PHP script writer’s point of view, the change most likely to impact legacy code is in the way that references are handled in all PHP versions post-dating the PHP 4.4.0 release.
Until and including PHP 4.3, it was possible to send, assign or return variables by reference that should really be returned by value, such as a constant, a temporary value (e.g. the result of an expression), or the result of a function that had itself been returned by value, as here:
[sourcode lang=’php’][/sourcecode]
Although this code would usually work as expected under PHP 4.3, in the general case the result is undefined. The Zend Engine could not act correctly on these values as references. This bug could and did lead to various hard-to-reproduce memory corruption problems, particularly where the code base was large.
In PHP 4.4.0, PHP 5.0.4 and all subsequent PHP releases, the Engine was fixed to ‘know’ when the reference operation is being used on a value that should not be referenced. The actual value is now used in such cases, and a warning is emitted. The warning takes the form of an E_NOTICE in PHP 4.4.0 and up, and E_STRICT in PHP 5.0.4 and up.
Code that could potentially produce memory corruption can no longer do so. However, some legacy code might work differently as a result.
Code that worked under PHP 4.3, but now fails

< ?php
function func(&$arraykey) {
    return $arraykey; // function returns by value!
$array = array('a', 'b', 'c');
foreach (array_keys($array) as $key) {
    $y = &func($array&#91;$key&#93;);
    $z&#91;&#93; =& $y;

Running the above script under any version of PHP that pre-dates the reference fix would produce this output:

array(3) {
&string(1) “a”
&string(1) “b”
&string(1) “c”

Following the reference fix, the same code would result in:

array(3) {
&string(1) “c”
&string(1) “c”
&string(1) “c”

This is because, following the changes, func() assigns by value. The value of $y is re-assigned, and reference-binding is preserved from $z. Prior to the fix, the value was assigned by reference, leading $y to be re-bound on each assignment. The attempt to bind to a temporary value by reference was the cause of the memory corruption.
Such code can be made to work identically in both the pre-fix and the post-fix PHP versions. The signature of func() can be altered to return by reference, or the reference assignment can be removed from the result of func().
[sourcode lang=’php’][/sourcecode]
In PHP 4.3 $x would be ‘original value’, whereas after the changes it would be ‘function return’ – remember that where the function does not return by reference, the reference assignment is converted to a regular assignment. Again, this can be brought to a common base, either by forcing func() to return by reference or by eliminating the by-reference assignment.
Code that worked under PHP 4.3.x, but now throws an error

< ?php
class Foo {
    function getThis() {
        return $this;
    function destroyThis() {
        $baz =& $this->getThis();
$bar = new Foo();

In PHP 5.0.3, $bar evaluated to NULL instead of returning an object. That happened because getThis() returns by value, but the value here is assigned by reference. Although it now works in the expected way, this is actually invalid code which will throw an E_NOTICE under PHP 4.4 or an E_STRICT under PHP 5.0.4 and up.
Code that failed under PHP 4.3.x, but now works

< ?php
function &f() {
    $x = "foo";
    print "$x\n";
for ($i = 0; $i < 3; $i++) {
    $h = &f();

In PHP 4.3 the third call to var_dump() produces NULL, due to the memory corruption caused by returning an uninitialized value by reference. This is valid code in PHP 5.0.4 and up, but threw errors in earlier releases of PHP.

< ?php
$arr = array('a1' => array('alfa' => 'ok'));
$arr =& $arr['a1'];
echo '-'.$arr['alfa']."-\n";

Until PHP 5.0.5, it wasn’t possible to assign an array element by reference in this way. It now is.
Code that should have worked under PHP 5.0.x
There are a couple of instances of bugs reported under PHP 5.0 prior to the reference fixes which now ‘work’. However, in both cases errors are thrown by PHP 5.1.x, because the code was invalid in the first place. Returning values by reference using self:: now works in the general case but throws an E_STRICT warning, and although your mileage may vary when assigning by reference to an overloaded object, you will still see an E_ERROR when you try it, even where the assignment itself appears to work.
Warnings that came and went
Nested calls to functions returning by reference are valid code under both PHP 4.3.x and PHP 5.1.x, but threw an unwarranted E_NOTICE or E_STRICT under the intervening PHP releases.

< ?php
function & foo() {
    $var = 'ok';
    return $var;
function & bar() {
    return foo();
$a =& bar();
echo "$a\n";