Tag: zend

How PHP Programming Language and Zend Framework are Helpful?

PHP provides support to different databases like Oracle, Sybase, MySQL, etc & it can be easily embedded in to HTML also. It rapidly grew to become much more robust language, but was originally designed for use in Web Site Development. In a nutshell, PHP is most popular because of its functionality which can be changed as per ones requirements.

PHP is the most popular web scripting language as well as a widely used programming language used for web-site development. PHP stands for “Hypertext Preprocessor” but it originally stood for “Personal Home Page” in 1995. It is a brilliant language which was originally designed for producing dynamic web pages for virtually any web application. PHP is a general purpose scripting language that facilitates developer in making dynamically driven websites & it is easy to learn & understand.

In PHP community, PHP frameworks are the newest buzz word from recent years. There’s different kinds of frameworks obtainable & it is lovely for developers to select the right framework. The objective of a framework is make the web-based applications method less hard. This helps in reusing the developed code, intuitive to work with & of work stable. A quantity of the important frameworks are Zend framework, Symfony, CakePHP, Prado & Solar. Among these, Zend framework is the most hyped framework as well as a web based application designed to build complex PHP applications simpler.

Benefits of PHP application development:

- PHP integrates well with HTML which is its primary use i.e. the actual PHP code can be embedded in to HTML code. This enables your web server to method web pages before they are actually displayed in the user’s web browser.

- PHP is an open-source language so it is free. It can be easily installed & you don’t need to pay thousands of dollars to purchase. It is used by millions of people & giant group of developers around the globe.

- PHP is generally human friendly (simple & easy to learn) than other high level programming languages such as C, C++, ASP or ASP.net.

- PHP is versatile which is supported on most web servers & runs on all major operating systems like Mac OS, windows, Linux etc.

- The most recent version of PHP is stable. It is used for web programming much like C / JavaScript, Java & Microsoft C#.

- PHP results in quicker navigation & efficient page loading as its processing speed is faster.

PHP is a well-established language. Its popularity continues to grow rapidly because it is free (it is open-source application), it is speedy (It can be easily embedded in to HTML), have full object oriented support & giant capability to build any sort of application which can run in web browser.
Pro Zend Framework Techniques: Build a Full CMS Project

US $4.97
End Date: Wednesday Sep-08-2010 15:24:52 PDT
Buy It Now for only: US $4.97
Buy it now | Add to watch list


Zend Issues Significant Update to Zend Studio 7 Enterprise PHP IDE

Zend Issues Significant Update to Zend Studio 7 Enterprise PHP IDE
Pro Zend Framework Techniques: Build a Full CMS Project

US $8.95
End Date: Wednesday Sep-08-2010 15:25:22 PDT
Buy It Now for only: US $8.95
Buy it now | Add to watch list

Zend Studio 7.1 Now Supports Task-Focused Programming, Remote Server Synchronization, and PHP Archives.

Read more on PRWeb via Yahoo! News


Popular PHP Frameworks: What’s Your Fav?

What is Your Fav PHP Framework?

View Results

Loading ... Loading ...

I have touched on PHP frameworks before that has sparked up a lot of discussion.  A lot of people swear by one framework and other developers another.  Before you first get into one you might want to ask yourself if you need to use a PHP framework.  You might not even need to use one.  But the fact is that over time, they can significantly reduce development time.

Okay, so let’s say that you are new to PHP frameworks.  There are a few popular choices out there to sink your teeth into, but which one?  You don’t want to pick a framework to spend days upon days learning the architecture, only to find out that no other PHP developers out there are using that framework.  Thus making the time you spent learning the framework’s ins and outs a waste of time.

In a perfect world, I would suggest to learn them all!  However, there are only 24 hours in a day, and prioritizing your PHP framework education might be a good idea. So above I added a poll that I plead to other PHP developers out there to vote on.  Hopefully after a lot of participation we will see the most popular PHP framework.

Remember, BrownPHP is a site that helps other PHP developers.  By us learning what the most popular PHP frameworks, it will allow us to become more efficient, and ultimately more successful!  If you do feel strongly about one PHP framework over another, please leave a comment and explain why you chose the PHP framework that you did.


Zend_Cache is Saving me Money!

Let me tell you a little story.  My latest site I have been working on for some time was written using the Zend Framework.  Since it was launched in Oct 07, it has been growing rapidly enough where I am now starting to feel growing pains.

One morning I went into the site to check some analytics, and my site was displaying a 403 Forbidden error!  I suddenly got a cold nervous sweat down the back of my spine.  Why was it forbidden?  It was fine when I checked it out last night?!  So I tried to login to my FTP account.  No go!  I I thought a hacker has some how blocked me out of my own account. [Exit dramatic build up].

I come to find out that my hosting company revoked my access to the folder that I was using for the domain.  I called them up immediately after I noticed that.  They responded by telling me that on a shared server, they limit their clients to use only 2% of the servers resources before they shut them down.  My site was using 30%. They were then forced to shut the site down without notice, because it was most likely affecting the performance of the other sites running from that shared server.

After some negotiating and explaining to them that I was going to come up with a solution, they temporarily gave me back access to the folder so that I could diagnose further what was going on.  The first thing that I did was looked through the server logs.  Because of my unfortunate neglect, the server log file was freaking enormous bigger than normal.

Nearly all of the errors I was getting were:

[03-Jul-2008 09:41:19] PHP Fatal error:  Uncaught exception 'Zend_Db_Adapter_Exception' with message 'SQLSTATE[42000] [1203] User blank already has more than 'max_user_connections' active connections' in blah blah blah

I’ll admit, I was in a huge hurry to get this project done, so I wasn’t thinking about the long tern effects.  Needless to say, I wasn’t caching my MySQL query results. I know, tisk tisk. Once I discovered this, I added this private method to my classes:


private function loadCache()
{
$frontendOptions = array(
'lifetime' => 7200, // cache lifetime of 2 hours
'automatic_serialization' =>
true);
$backendOptions = array(
'cache_dir' => './cache/' // Directory where to put the cache files
); // getting a Zend_Cache_Core object
return Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
}

Then in each of my classes where I needed to cache my query results, I implemented the above method. Here is an example:


class IndexController extends Zend_Controller_Action {
/**
* Index Action
*
*/
public function indexAction() {
$db = new SomeDB;
$cache = $this->loadCache();
if (!$results = $cache->load('cache_variable')) {
$results = $db->fetchAll('columnName="whatIWant"');
$cache->save($results, 'cache_variable');
}
}
}

It’s pretty much as simple as that.  Once I did this, it dropped the server load tremendously, which now buys me more time from upgrading my hosting package.  About 10 minutes of coding just saved me about $50 a month in hosting fees!  That feels good.

Keep in mind that this is not the best approach to solving this problem.  If you too are using the Zend Framework in your own design.  It was be better to initialize the Zend_Cache in your bootstrap file.  Doing it the way I did above will force you to replicate the code method, loadCache, in all of your classes which I dont’ have to explain to you why this is inefficient, and just plain old bad OOP technique! :P


  • BrownPHP Tag Cloud

  • Copyright © 1996-2010 Brown PHP. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress

    Powered by Yahoo! Answers