Basic sendmail configuration on XAMPP Windows using an Office 365 account


sendmail_from =
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

Source: How to configure XAMPP to send mail from localhost?

Zend Framework quickstart – Part 1

Here are the links that I followed while getting started with the Zend Framework:

So far, Zend Framework looks pretty much like CodeIgniter in a way that I can use loosely-coupled component libraries at will and I have a lot of control over the architecture. It also provides an MVC implementation similar to CodeIgniter.

When I was reading the links above, I noticed that some of the details were missing in order to successfully complete a small project using Zend Framework without pulling my hair a couple of times. So I wrote my own so I can just look this post up if ever I forget some of the important details and perhaps some other ZF n00b out there can benefit from this post as well. Here it is…

Get a copy of the Zend Framework

I downloaded the latest version of Zend Framework from the Latest Release of ZF page instead of installing Zend Server (which contains Zend Framework with a complete PHP stack) on my development machine since I don’t have a production server where I can install the Zend Server, because Zend Server will replace your Linux distro’s PHP that may cause conflict between RPM packages. I’d rather setup my development environment similar to the setup of the servers that I have right now so don’t have to worry much about package incompatibilities during deployment.

In the Latest Release of ZF page, choose the full framework which doesn’t require registration. In my case, I downloaded Zend Framework 1.10.8 Full (released 2010-08-25). Extract the contents of the archive. In my (Fedora) Linux machine, I extracted it under /home/randell/ZendFramework-1.10.8. In Windows, I extracted it under C:/ZendFramework-1.10.8.

Setup the zf command line tool

We’ll be using the zf command line tool to create our new project. For that, we need to properly setup our environment variables for both PHP and the zf tool. The zf command line tools (zf.bat for Windows and for Unix-based OSes) are located in the /bin directory of your Zend Framework installation.

Create the project

After setting-up the command line tool, we can now create our project. From the command line, navigate to the directory where we will create your project. In my Linux machine, I created it under /var/www/html/. In Windows, I created it under C:/xampp-1.7.1/htdocs. Both directories is where I run all my other PHP projects. To create the project, execute the following command:

zf create project quickstart

Running this command will create your basic site structure, including your initial controllers and views. Both in Windows and in Linux, you could get a message similar to this after executing the command:

Note: This command created a web project, for more information setting up your VHOST, please see docs/README

The tree structure of the generated project looks something like this:

|-- application
|    |-- configs
|    |    `-- application.ini
|    |-- controllers
|    |    |-- ErrorController.php
|    |    `-- IndexController.php
|    |-- models
|    |-- views
|    |    |-- helpers
|    |    |-- scripts
|    |         |-- error
|    |         |    `-- error.phtml
|    |         |-- index
|    |              `-- index.phtml
|    `-- Bootstrap.php
|-- docs
|    `-- README.txt
|-- library
|-- public
|    |-- .htaccess
|    `-- index.php
|-- tests
|    |-- application
|    |    `-- bootstrap.php
|    |-- library
|    |    `-- bootstrap.php
|    `-- phpunit.xml
`-- .zfproject.xml

Don’t worry about the contents of those files yet because I will try to explain the important ones as detailed as possible in my next post. For now, let’s just get the basic setup up and running.

Next step is to copy the Zend library (library/Zend)from our extracted Zend Framework archive to the library directory of our project. We’re doing this so that our project has a copy of the Zend Framework whenever we decide to deploy it on a different server.

Create a virtual host

Let’s modify our httpd.conf and hosts files using any text editor.

Append the following lines at the end of httpd.conf file (/etc/httpd/conf/httpd.conf and /etc/hosts in Fedora):

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName quickstart.local
    DocumentRoot /var/www/html/quickstart/public

    SetEnv APPLICATION_ENV "development"

    <Directory /var/www/html/quickstart/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all

DocumentRoot specifies the public subdirectory of our project (only files under that directory can ever be served directly by the server). Take note of the public. Most people tend to forget that part, especially when coming from other frameworks where the index.php doesn’t reside on a directory other than the root. The SetEnv directive sets an environment variable for our virtual host and will be picked up by index.php (in the public directory) and set the APPLICATION_ENV constant for our application.

Append the following to the hosts file (/etc/hosts in Fedora and C:/WINDOWS/system32/drivers/etc/hosts in Windows XP): quickstart.local

Then restart our server. We can now access our application from http://quickstart.local and see something like this from our browser:

Welcome to the Zend Framework

Welcome to the Zend Framework

Got questions or suggestions about this post? Feel free to post a comment or drop me an email.

Setup Zend Command Line Console Tool in Windows XP

The CLI, or command line tool (internally known as the console tool), is currently the primary interface for dispatching Zend_Tool requests. With the CLI tool, developers can issue tooling requests inside the “command line windows”, also commonly known as a “terminal” window.

Some examples of actions that you can perform with the Zend Framework Command Line Console Tool (a.k.a Zend CLI Tool) are the following:

zf create project path-to-project name-of-profile file-of-profile
zf create model name module
zf create view controller-name action-name-or-simple-name

Assuming that we have downloaded and extracted the Zend Framework archive, Running it on Windows by typing zf.bat in the command prompt under the /bin directory without setting-up the environment variables will give us the following message:

‘”php.exe”‘ is not recognized as an internal or external command, operable program or batch file.

In order to let Windows know how to execute PHP scripts, we need to tell it where php.exe is located. To do that, right click on My Computer, click Properties, click on the Advanced tab, and click the Environment Variables button. Under System Variables, select Path and click on the Edit button. At the end of the Variable value field, add the path to your php. In my case, I appended


The semicolon is used to separate the paths  in the Path System Variable value field. To test it we can type the following from the command prompt under the our zf.bat‘s directory:

zf show version

and we should get a message similar to this:

Zend Framework Version: 1.10.8

We can also just execute zf to check out the other actions you can perform with the Zend Tool.

Now we also want the Zend command line tool to be reachable from our system path so that we can call zf from the command prompt, regardless of our current work directory. Similar to how we added php.exe in the environment variables, let’s add the path to our zf.bat to our path environment variable. In my case, I added ;C:ZendFramework-1.10.8bin. To test it, execute zf show version from your command prompt in any directory and you should get the Zend Framework version similar to the one we got earlier.