So today am going to show you how to install Zend on your shared hosting plan because am pretty sure that the majority of the people start off with this type of plan. This tutorial is also be the first tutorial of our Zend tutorials.
The first thing you have to do is download the framework, you have to make an account but it’s free so don’t worry. We are going to be using the full package download ( ZendFramework-1.8.0 ).
Okay, so now that you have downloaded and extracted the contents rename the folder “ZendFramework-1.8.0″ to simply “zend” so that we are on the same page, and don’t worry you’ll be able to change this later. Now, upload this folder to your the root of your server
The next thing we need is your document root folder which can be obtained by uploading a php file with the following contents.
/home/content/u/s/e/username/html
We will use this to set the “include path” in your php.ini, this means that you won’t have to type a long file path every time you want to use Zend.
To set the include path add the following line of code to your php.ini file and upload it.
include_path = /home/content/u/s/e/username/html/zend/library
No trailing slash as you can see.
Important: Your php.ini might also be called php5.ini . So if that’s what it is use that file instead.
That’s it! Now to test the installation upload a php file with the followin lines of code
If your hosting provider won’t let you play with the ini file you might have to set the include path in any file you intend to use Zend, this means you are going to have to add the following line of code to the php files where you’ll use Zend.
That’s it for today, I hope you were able to install Zend. If you can’t wait for our tutorials check out the Zend framework manual at
The first thing you have to do is download the framework, you have to make an account but it’s free so don’t worry. We are going to be using the full package download ( ZendFramework-1.8.0 ).
http://www.zend.com/community/downloads
Okay, so now that you have downloaded and extracted the contents rename the folder “ZendFramework-1.8.0″ to simply “zend” so that we are on the same page, and don’t worry you’ll be able to change this later. Now, upload this folder to your the root of your server
The next thing we need is your document root folder which can be obtained by uploading a php file with the following contents.
echo $_SERVER['DOCUMENT_ROOT'];
My result was similar to the following, am hosting on godaddy btw.
/home/content/u/s/e/username/html
We will use this to set the “include path” in your php.ini, this means that you won’t have to type a long file path every time you want to use Zend.
To set the include path add the following line of code to your php.ini file and upload it.
include_path = /home/content/u/s/e/username/html/zend/library
No trailing slash as you can see.
Important: Your php.ini might also be called php5.ini . So if that’s what it is use that file instead.
That’s it! Now to test the installation upload a php file with the followin lines of code
require_once 'Zend/Mail.php';
$mail=new Zend_Mail();
echo 'it worked';
All we are doing here is including the mail class, which we’ll use in our next tutorial, if you don’t get any errors then it means it worked.
If your hosting provider won’t let you play with the ini file you might have to set the include path in any file you intend to use Zend, this means you are going to have to add the following line of code to the php files where you’ll use Zend.
set_include_path('/home/content/u/s/e/user/html/zend/library');So the previous snippet of code where we included the Mail class will become this.
set_include_path('/home/content/u/s/e/user/html/zend/library');
require_once 'Zend/Mail.php';
$mail=new Zend_Mail();
echo 'it worked';
Just a quick explanation about the require_once line: The include path is set to point to the “library” folder in the “zend” folder we renamed and uploaded, inside this “library” folder there is a “Zend” folder with the “Mail.php” class and many other classes.
That’s it for today, I hope you were able to install Zend. If you can’t wait for our tutorials check out the Zend framework manual at
http://framework.zend.com/manual/en/
No comments:
Post a Comment