Installing Zend Framework

An Introduction to Zend Framework

Zend Framework is a free open-source object oriented web application framework for PHP 5. The Zend Framework provides an advanced Model-View-Controller (MVC) implementation that is designed to help you establish a basic structure for your Zend Framework applications. Zend Framework is often referred to as a “component library” since it has many loosely coupled components that you can use independently. Zend Framework is designed for programmers, allowing them to focus on their project without having to repeatedly write repetitious code.

Is Zend Framework installed on InMotion Hosting servers?

No, Zend Framework is not installed on the servers. If you would like to use it, you will need to install the Zend Framework yourself. The Zend Framework can be installed and used on all of our servers. This installation guide will show you how to install it on a shared server.

How to install Zend Framework

  1. The first step is to download the latest version of Zend Framework from their website. You’ll need to create an account on the website and follow their instructions to do so.  Make sure to use the Full Package download.
    Zend_Downloads_1

  2. Once you have downloaded the zip file to your local machine you will need to upload it to your public_html folder on the server.
    Zend_Upload_2

  3. Create a folder in the public_html folder called “zf”
  4. Now, unzip the file you uploaded so the contents are in the “zf” folder.
    Zend_unzipped_3

  5. Now, you’ll need to add the include_path to your php.ini file. If you’re not familiar with your php.ini file please see our article.
    Zend_phpini_4

  6. If you have not done so already, you’ll need to set your php.ini file to be recursive. If you are not familiar with how to do this, please see our article.
  7. Now, that you have made sure the php.ini file is recursive you’re finished!

Now, that you have installed Zend Framework you can test it to be sure it is installed correctly. There are two methods we’ll cover here to be sure it is installed correctly and functioning as it should.

Creating a “Hello World” script to test Zend Framework

In this section of the tutorial we’re going to show you how to create a “Hello World” script using Zend Framework. This ‘Hello World’ script is not designed to print to your screen but creates a file called “hello.php” in the same folder.

  1. First, you’ll need to log into cPanel and create a file in File Manager in the public_html folder called “hello_Zend.php”
  2. Next, you’ll need to copy the code below and use “Code Edit” to paste the code into your hello_Zend.php file.
     
    
    <?php require_once 'Zend/Pdf.php';   
    /* create a new pdf document */     
    $pdf = new Zend_Pdf();     
    
    /* create a page */                 
    $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);  
    
    /* setup font */                    
    $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);    
    /* write text to page */            
    $page->setFont($font, 48); 
    $page->drawText('Hello, World!', 250, 500);   
    
    /* add page to document */ 
    $pdf->pages[] = $page;   
    
    /* save pdf */ 
    
    $pdf->save('hello.pdf'); ?>
    
    
  3. Once you have saved the file, you will need to visit the file you have just created in a web browser. The file will be located at https://example.com/hello_Zend.php Be sure to replace example.com with your actual domain. Please note, the file will not display anything on the screen. The ‘Hello World’ file we just created is actually designed to create a PDF file in the same directory called “hello.pdf”
  4. Look in file manager, within cPanel and verify the pdf file was created. Be sure to refresh cPanel to see the file if you are still logged in. Now, visit the file in your web browser by going to https://example.com/hello.pdf – You should see something similar as below:hello_world_2

If you see the results as the above screenshot, you have been successful in creating your first Zend Framework ‘Hello World’ script. If you need further assistance please feel free to contact our support department.

When I look at my php.ini file I see the Zend Engine. What is that?

No, the Zend Engine is not the same as the Zend Framework. If you are looking into your php.ini file and see Zend Engine or Zend Optimizer, it is not referring to the Zend Framework. Zend Engine is a PHP execution engine that actually executes the PHP files. Zend optimizer is a free application that is able to execute certain encrypted files. The main function of Zend Optimizer is to improve the efficiency of PHP applications. It revised the code created by the encryption software (Zend Guard) and enhances it for faster performance.

Carrie Smaha
Carrie Smaha Senior Manager Marketing Operations

Carrie enjoys working on demand generation and product marketing projects that tap into multi-touch campaign design, technical SEO, content marketing, software design, and business operations.

More Articles by Carrie

7 thoughts on “Installing Zend Framework

    1. Hello yogi,

      Only users running on a server with PHP loaded as a “CGI module” will have a php.ini file. The php.ini file by default will be located at public_html/php.ini. If you do not see a file named php.ini in your public_html, please contact our Support Department and request that we create one for you.

      Thank you,
      John-Paul

Was this article helpful? Join the conversation!