Print

SiteGround Tutorials


PHP Tutorial

What is PHP?

PHP was at first created as a simple scripting platform called "Personal Home Page". Nowadays PHP (the short for Hypertext Pre-Processor) is an alternative to Microsoft's Active Server Page (ASP) technology. It is an open source server-side language, which is used for creating dynamic web pages, which will be embedded in HTML. PHP is usually used in conjunction with a MySQL database on Linux/UNIX web servers. It is one of the most popular scripting languages among today's web developers.

A unique feature of PHP is that it can also be embedded within those HTML pages that are saved with a .php file extension, allowing you to change the content of many web pages at a time by simply modifying one .php file. A server-side PHP engine transforms all PHP sections into HTML and the visitor does not see any of the PHP script.

PHP is a widely-used general-purpose scripting language and interpreter that is freely available. A full explanation of all the PHP tags, complete user manual and lots of tutorials can be found on PHP's official page.



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

MySQL Tutorial

What is MySQL?

MySQL is a freely available open source Relational Database Management System [RDBMS], a database engine of sorts that uses Structured Query Language (SQL). SQL is the most popular language for adding, accessing, and processing data in a database, and is most noted for its rapid processing, proven reliability, and ease and flexibility of use. Best mate for PHP, MySQL is part in almost every open source application. Good examples for use of its power are phpBB, osCommerce, and phpNuke.

You can see how dynamic MySQL can be when used together with PHP on the web site of the hottest web2.0 applications digg.com and del.icio.us. You can search with 1 keyword or a keyword phrase, the returned results are sorted and best matched through the combined use of PHP and MySQL, generating a dynamically created web page on the fly. Our own site uses MySQL, which manages to answer more than 120 queries per second! Can you do that?

MySQL can be used on multiple web servers, including Windows and Linux and it is offered in all the SiteGround's packages free of charge.



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

MySQL Tutorial: Creating MySQL Database and User

Check out the Creating and Modifying MySQL Databases video tutorial:
Creating and Modifying MySQL Databases Video Tutorial Creating and Modifying MySQL Databases Video Tutorial

Creating a MySQL Database Detailed Tutorial

Creating a MySQL database with cPanel, which is included in all of the SiteGround's Linux hosting plans can be easily accomplished. In order to create a MySQL database on your hosting account, you need to log into the cPanel. This can be done by either using the [Go!] button in the Manage Account section of the customer area as shown in the image below:

SiteGround web hosting: Manage accounts -> Go!

or you may use one of the following URL':

http://yourdomain.com/cpanel
http://cpanel.servername.com

Important Please bear in mind, that you have to replace "yourdomain.com" with your actual domain name or servername.com with the hostname of the SiteGround server on which your account is located.

Once you have logged into the cPanel, you can access the MySQL management screen by clicking the [MySQL Databases] button as shown below.

MySQL Databases button

In order to create a new database all you need to do is enter the desired name for the database in the New Database field, then click the [Create Database] button as shown below:

Create Database

ImportantFeel free to check the video tutorial on adding new databases and database usernames that is available on this page. You might find it very helpful.

A confirmation screen like this one will be displayed, informing the database is successfully created:

Create Database

You can click on the [Go Back] button and will be returned to the database management screen.

Important The MySQL database is created with your username as prefix - username_databasename, and this is the name you have to use for your application.

Creating a MySQL Username Detailed Tutorial

You can now continue with the creation of a user, who will be able to connect to the newly created database. Creating a user is much like any other registration. You just need to fill in the desired user name and password like shown in the image below:

Creating a MySQL username

Again a confirmation page will be loaded.

ImportantYou should always bear in mind that a prefix will be added to all databases and usernames you create, which will be your cPanel username.

Adding a user to a MySQL Database Detailed Tutorial

Once the database and the username are created, you can add certain privileges for the user to the database. In order to do so you should select both from the corresponding drop down menu under Add User To Database and click the [Submit] button:

Add User To Database

You will be redirected to a screen where you will be prompted to choose the desired privileges. It is advisable to select All Privileges then click the [Make Changes] button:

MySQL Privileges

Using the MySQL Database Wizard

All of the steps above can be accoplished using the [MySQL Database Wizard]. All you need to click on it and you will be brought trough all steps that you should perform in order to successfully create a new MySQL database and add privileged user to it.

MySQL Database Wizard

Check out the Using MySQL Databases Wizard video tutorial:
Using MySQL Databases Wizard Video Tutorial Using MySQL Databases Wizard Video Tutorial

MySQL Tutorial: Removing MySQL Database and User

Removing Privileged User from a database

If you would like to remove a privileged user from a database you can easily do so by clicking the button for the database and username in question as show below:

Removing Privileged User from a database

A confirmation message for the removal will be loaded. This means that the username no longer has any privileges to the database.

Removing a MySQL database

If you would like a MySQL database removed this can be easily accomplished by clicking the [Delete Database] button for the database in question:

Delete Database

You will get a confirmation screen when the database is removed.

Important Note that this process is irreversible and all the data from this database will be lost.

Removing a MySQL User

If a MySQL username is no loger needed you can remove it by clicking the Delete button next to it under Current Users as shown below:

Delete Current Users

Again a confirmation screen will be shown upon successful removal.



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

MySQL Tutorial

How to Access and Manage your MySQL Database - phpMyAdmin

Now there are two ways to access and manage your newly created database. The first one is locally trough the Web based manager - phpMyAdmin, which is accessed trough the cPanel Databases section.

SiteGround web hosting: phpMyAdmin

A new page/tab of your browser will open and the phpMyAdmin will load there and looks like this:

phpMyAdmin - Choose a database

Check out how to manage MySQL database through phpMyAdmin video tutorial:
how to manage MySQL database through phpMyAdmin Video Tutorial How to Manage MySQL Database Through phpMyAdmin Video Tutorial

With phpMyAdmin you can:

MySQL Tutorial

MySQL Export: How to backup your MySQL database?

You can easily create a database dump (export/backup) of a databases used by your account. In order to do so you should access the phpMyAdmin interface available in the cPanel for your account:

phpMyAdmin

You will be brought through a redirect screen stating that the phpMyAdmin tool will be loaded shortly then the new page will be automatically loaded in your browser.

Once the phpMyAdmin tool loads, you can select the database that you would like to backup from the drop-down menu called Database (located in the upper left corner of your web browser).

phpMyAdmin - Choose a database

A new page will be loaded in phpMyAdmin for the database selected from the drop-down menu. In order to proceed with the backup click on the [Export tab]:

phpMyAdmin - Export

The options that is advisable to select apart from the default ones are Save as file (which will save the file locally to your computer in a .sql format) and Add DROP TABLE (which will add the drop if table already exists statement in the database backup) as shown below:

phpMyAdmin - Save as file

This is all that needs to be done and you can click the [Go] button to start the export/backup of your database:

Export/backup a MySQL database

A download window will popup prompting for the exact place where you would like to save the file on your local computer or automatically start the download depending on your local settings.

MySQL Import: How to restore your MySQL database from a backup

To restore (import) a database via phpMyAdmin, first choose the database you'll be restoring from the left menu. Then click the [Import tab]:

Importing a MySQL database via phpMyAdmin

You have the option of importing an .sql file. Use the [Browse] button to find it on your local computer. Note that you are given the option to choose the character set of the file from the drop down menu just below the box when the backup file will be specified. If you feel uncertain about the character set your database is using just leave the default one.

Importing an .sql file

In order to start the restore click the [Go] button in the bottom-right. A notification will be displayed upon successful database import.



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

MySQL Tutorial

Adding MySQL access hosts

You can allow access to MySQL databases from external locations by adding their domain name or IP address to the list of hosts that are able to access databases on your web site. In addition, if you would like to manage your database using an application for remote database management, the IP address from which the connection is established should be added in the list of the allowed hosts.

In order to add allowed hosts you should access the tool via cPanel -> Remote MySQL:

cPanel -> Remote MySQL

On the loaded page you should enter the desired domain name or IP address in the hosts field:

Enter the domain name or IP address

then click the [Add host] button.

A confirmation screen will be loaded that the host is successfully added and next time you access Remote MySQL the newly added host will be listed under Access Hosts.



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

PHP/MySQL Tutorial - PHP MySQL Connection

Step 1:

PHPinfo

One of the most basic PHP tags is the PHPinfo. Open just any text editor (like notepad) and type in the following:

<?
phpinfo();
?>

And save it as phpinfo.php

Now upload this to your public_html directory and go to it in your browser using the following link:

http://yourdomain.com/phpinfo.php

You will see a huge page with all the details of the PHP installation on it, scroll down through all this information and you will see a section where the MySQL details are fitted.

Before you can do anything with your database, you must create a table. A table is a section of the database for storing related information. In a table you will set up the different fields which will be used in that table. Because of this construction, nearly all of a site's database needs can be satisfied using just one database.

Creating a table in PHPMyAdmin is simple, just type the name, select the number of fields and click the button. You will then be taken to a setup screen where you must create the fields for the database. If you are using a PHP script to create your database, the whole creation and setup will be done in one command.

Creating a table in PHP is slightly more difficult than with MySQL. It takes the following format:

CREATE TABLE tablename {

Fields

}

The fields are defined as follows:

fieldname type(length) extra info,

The final field entered should not have a comma after it.

Step 2: Connect to the Database
Step 3: Execute commands on the server
Step 4: Display table data
Step 5: Select individual records



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

PHP/MySQL Tutorial - PHP MySQL Connection

Step 2:

How to Connect to Your Database

The first thing you must do before you can do any work at all is to connect to the MySQL database. This is an extremely important step as, if you are not connected, your commands to the database will fail.

Good practice for using databases is to specify the username, password and database name first so that if you change any of them at a later date you will only have to change one line:

$username="username";
$password="password";
$database="your_database";

At this point you may be wondering if it is a security risk, keeping your password in the file. You don't need to worry, though, because the PHP source code is processed by the server before being sent to the browser so it is impossible for the user to see the script's source.

Next, you will need to issue the command to start a database connection:

mysql_connect(localhost,$username,$password);

This line tells PHP to connect to the MySQL database server at 'localhost' (localhost means the server that the site is running one. Another vital command is:

mysql_close();

This is a very important command as it closes the connection to the database server. Your script will still run if you do not include this command but too many open MySQL connections can cause problems for your account. It is good practice to always include this line once you have issued all your commands to the database, to keep the server running well.

After you have connected to the database server you must then select the database you wish to use. This must be a database to which your username has access. The following command:

@mysql_select_db($database) or die( "Unable to select database");

is used to do this. This tells PHP to select the database stored in the variable $database (which you have set earlier). If it cannot connect it will stop executing the script and output the text:

Unable to select database

This extra 'or die' part is good to leave in as it provides a little error control but it is not essential.

Now you have connected to the server and selected the database you want to work with, you can begin executing commands on the server.

Step 3: Execute commands on the server
Step 4: Display table data
Step 5: Select individual records



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

PHP/MySQL Tutorial - PHP MySQL Connection

Step 3:

How to Execute Server Commands

There are two ways of executing a command. One is to just enter the command in PHP. This way is used if there will be no results from the operation.

The other way is to define the command as a variable. This will set the variable with the results of the operation.

In this part of the tutorial we will use the first way as we are not expecting a response from the database. The command will look like this:

mysql_query($query);

The useful thing about using this form of the command is that you can just repeat the same command over and over again without learning new ones. All you need to do is to change the variable.

Here is the complete code that should be used to create a MySQL table in PHP:

<?
$user="username";
$password="password";
$database="database";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="CREATE TABLE tablename(id int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,field1-name varchar(20) NOT NULL,fiels1-name varchar(20) NOT NULL,field3-name varchar(20) NOT NULL,field4-name varchar(30) NOT NULL,field5-name varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";
mysql_query($query);
mysql_close();
?>

Enter your database, MySQL username and MySQL password in the appropriate positions on the first three lines above.

The next query should fill in the table. Here is a sample one:

$query = "INSERT INTO tablename VALUES
('','$field1-name','$field2-name','$field3-name','$field4-name','$field5-name')";

You can't insert more values than the number of fields you have created with the previous query.

Step 4: Display table data
Step 5: Select individual records



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

PHP/MySQL Tutorial - PHP MySQL Connection

Step 4:

How to Display MySQL Table Data?

After you have created the table and filled it with data, you will probably need to display it. This is usually done using basic HTML code. Putting the data using HTML pages is almost identical to inserting it using a PHP script. The benefit, though, is that you do not need to change the script for each piece of data you want to input and you can also allow your users to input their own data.

The following code inserted in an HTML page will display the data from the databases with textboxes in which the appropriate details are fitted:

<form action="insert.php" method="post">
Value1: <input type="text" name="field1-name"><br>
Value2: <input type="text" name="field2-name"><br>
Value3: <input type="text" name="field3-name"><br>
Value4: <input type="text" name="field4-name"><br>
Value5: <input type="text" name="field5-name"><br>
<input type="Submit">
</form>

The next thing you need is a new PHP script, which instead of filling in the database with data, will get the data and display it.

<?
$username="username";
$password="password";
$database="your_database";

$field1-name=$_POST['Value1'];
$field2-name=$_POST['Value2'];
$field3-name=$_POST['Value3'];
$field4-name=$_POST['Value4'];
$field5-name=$_POST['Value5'];

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO tablename VALUES
('','$field1-name','$field2-name','$field3-name','$field4-name','$field5-name')" ;mysql_query($query);

mysql_close();
?>

This script should then be saved as insert.php so that it can be called by the HTML form. It works because, instead of the data being entered locally, it is being entered into the form and stored in variables which are then passed to the PHP.

Now that you have at least one record, if not many more, in your database you will want to know how you can output this data using PHP.

The first command you will need to use is a MySQL query made up like this:

SELECT * FROM tablename

This is a basic MySQL command which will tell the script to select all the records in the tablename table. Because there will be output from this command it must be executed with the results being assigned to a variable:

$query="SELECT * FROM tablename";
$result=mysql_query($query);

In this case the whole contents of the database is now contained in a special array with the name $result. Before you can output this data you must change each piece into a separate variable. There are two stages to this.

The first one is counting the rows. Before you can go through the data in your result variable, you must know how many database rows there are. You could, of course, just type this into your code but it is not a very good solution as the whole script would need to be changed every time a new row was added. Instead you can use the command:

$num=mysql_numrows($result);

This will set the value of $num to be the number of rows stored in $result (the output you got from the database). This can then be used in a loop to get all the data and output it on the screen.

The second stage is to set up the loop. You must now set up a loop to take each row of the result and print out the data held there. By using $num, which you created above, you can loop through all the rows quite easily. In the code below, $i is the number of times the loop has run and is used to make sure the loop stops at the end of the results so there are no errors.

$i=0;
while ($i < $num) {

CODE

$i++;
}

This is a basic PHP loop and will execute the code the correct number of times. Each time $i will be one greater than the time before. This is useful, as $i can be used to tell the script which line of the results should be read. As the first line in MySQL output is 0, this will work correctly.

The final part of this output script is to assign each piece of data to its own variable. The following code is used to do this:

$variable=mysql_result($result,$i,"fieldname");

So to take each individual piece of data in our database we would use the following:

$field1-name=mysql_result($result,$i,"field1-name");
$field2-name=mysql_result($result,$i,"field2-name");
$field3-name=mysql_result($result,$i,"field3-name");
$field4-name=mysql_result($result,$i,"field4-name");
$field5-name=mysql_result($result,$i,"field5-name");

You do not need to get the ID field because there is no use for it in the output page.

You can now write a full script to output the data. In this script the data is not formatted when it is output:

<?
$username="username";
$password="password";
$database="your_database";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM tablename";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<b><center>Database Output</center></b><br><br>";

$i=0;
while ($i < $num) {

$field1-name=mysql_result($result,$i,"field1-name");
$field2-name=mysql_result($result,$i,"field2-name");
$field3-name=mysql_result($result,$i,"field3-name");
$field4-name=mysql_result($result,$i,"field4-name");
$field5-name=mysql_result($result,$i,"field5-name");

echo "<b>$field1-name
$field2-name2</b><br>$field3-name<br>$field4-name<br>$field5-name<hr><br>";

$i++;
}

?>

This outputs a list of all the Values stored in the database. This just gave you a very basic output, though and is not particularly useful for a working website. Instead, it would be better if you could format it into a table and display it like this. Doing this formatting is not particularly complicated. All you need to do is use PHP to output HTML and include your variables in the correct spaces. The easiest way to do this is by closing your PHP tag and entering the HTML normally. When you reach a variable position, include it as follows:

<? echo $variablename; ?>

in the correct position in your code.

You can also use the PHP loop to repeat the appropriate code and include it as part of a larger table. For example:

<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Value1</font></th>
<th><font face="Arial, Helvetica, sans-serif">Value2</font></th>
<th><font face="Arial, Helvetica, sans-serif">Value3</font></th>
<th><font face="Arial, Helvetica, sans-serif">Value4</font></th>
<th><font face="Arial, Helvetica, sans-serif">Value5</font></th>
</tr>

<?
$i=0;
while ($i < $num) {

$field1-name=mysql_result($result,$i,"field1-name");
$field2-name=mysql_result($result,$i,"field2-name");
$field3-name=mysql_result($result,$i,"field3-name");
$field4-name=mysql_result($result,$i,"field4-name");
$field5-name=mysql_result($result,$i,"field5-name");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $field1-name; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $field2-name; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $field3-name; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $field4-name; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $field5-name; ?></font></td>
</tr>

<?
$i++;
}

echo "</table>";

This code will print out table headers, and then add an extra row for each record in the database, formatting the data as it is output.

Step 5: Select individual records



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

PHP/MySQL Tutorial - PHP MySQL Connection

Step 5:

How to Select Individual Records

As well as showing the whole database, PHP can be used to select individual records, or records which match certain criteria. To do this you must use a variation of the SELECT query. To display the whole table you used the query:

SELECT * FROM tablename

If we just wanted to select ones which have value=1 in the field1-name row you would use the following query:

SELECT * FROM tablename WHERE fiels1-name='1'

As with other MySQL queries, it is almost like plain English text. In the same way you could select records based on any field in the database. You can also select ones with more than one field by adding more:

field='value'

sections onto the query.

For further reference you can visit the official websites of PHP and MySQL.



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved
Previous Next

Zend Optimizer Tutorial

Zend Optimizer is available on SiteGround Servers!

What is Zend Optimizer?

Zend Optimizer is a free application that runs the files encoded by the Zend Guard. Zend Optimizer greatly enhances the performance of PHP applications. Generally this is the main use of the Zend Optimizer software.

The Zend Optimizer goes over the code generated by the standard Zend run-time compiler and optimizes it for faster execution. In addition, the Zend Optimizer enables PHP to load and execute files encoded by using Zend Guard. The standard Zend run-time compiler used by PHP is indeed extremely fast, generating code that is usually 2 to 10 times faster. But an application that uses the Zend Optimizer, most commonly executes the scripts another 40% to 100% faster.

System requirements:

Supported Operating Systems, Platforms and OS versions:

  • Linux x86
  • Linux x86-64
  • Linux Power
  • Solaris Sparc 8, 9, 10
  • Solaris x86 9, 10
  • FreeBSD x86 5.x, 6.x
  • Windows x86 2000, XP, 2003
  • OS X Mac Power
  • AIX pSeries 5

Supported Web Servers:

  • Apache 1.3.x
  • Apache 2.0.x (Prefork mode only)
  • IIS 5, 6

PHP Compatibility

Supported PHP versions:

  • 4.2.x up to 4.4.x
  • 5.0.x, 5.1.x

OS X Mac supports PHP versions:

  • 4.3.x up through 5.1.x

Zend Guard Compatibility:

Files encoded with the Zend Guard must be compiled with a compatible version of Zend Guard. When in doubt always use the latest version of Zend Optimizer. If the versions of Zend Guard and Zend Optimizer are incompatible, the Optimizer will fail to run encoded files and will register an error message.

Interesting details:

Always bear in mind that Zend Optimizer will *not* run if the following PHP settings are enabled:

1. Thread Safety
2. Enable Versioning

To ensure that Zend Optimizer is properly running create a .php file with the following code:

<?php
phpinfo();
?>

Once this is done access the file via web browser. The part associated with Zend Optimizer will look like this:

This program makes use of the Zend scripting language engine: Zend Engine vX.Y.Z, Copyright (c) 1998-2006 by Zend Technologies Ltd. with Zend Optimizer vX.Y.Z, Copyright (c) 1998-2006 by Zend Technologies Ltd.

The downloaded package includes an "Accelerated by Zend Optimizer" icon which you can post on your site, thus letting users to know you are running Zend Optimizer.

The Zend Optimizer is capable of performing around 20 different optimizations, some of which are quite complex. One of the simpler optimizations that the Zend Optimizer does is to change post-incrementing to pre-incrementing, where possible, since pre-incrementing is the faster operation of the two. You can adjust your Zend Optimizer to perform only the desired optimizations. Each optimization can be turned on or off by setting the corresponding option. Currently the latest Zend Optimizer versions come with some of the most complex optimization options disabled as it is considered that way for best performance.



PHP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved

Pear Modules

By default all SiteGround servers have the following Pear packages installed:

  • Archive_Tar
  • Auth_SASL
  • Console_Getopt
  • DB
  • HTML_Template_IT
  • HTTP_Request
  • Log
  • Mail
  • Net_Socket
  • Net_URL
  • Net_UserAgent_Detect
  • PEAR
  • SOAP
  • Structures_Graph
  • XML_RPC

How to install additional Pear package?

However you can easily install any additional Pear package. In this tutorial we will demonstrate how to install the Calendar Pear package.

Step 1. First we go to http://pear.php.net/ and search for Calendar:

Pear package: Calendar

Step 2. The search will find the Calendar package with its Description: "A package for building Calendar data structures". We follow the link to the Calendar packet home page.

Step 3. There we click on the link to the Download section and choose to download the latest version;

Step 4. Once we have the package downloaded locally, we have to extract it. For this purpose use any popular archivator (7zip).

Step 5. Now you should have a folder called Calendar-X.X.X. In order to simplify things we will rename it to Calendar.

Step 6. Next connect to your account by FTP and create a directory called pear right in the home directory (it does not have to be in the webroot). Upload the Calendar directory inside the pear directory. You should upload similarly any other packages there.

Step 7. Next inform Php to include the local pear directory. This can be done by creating a file, called php.ini and pasting the following source code into it:

include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/my_user_name/pear";

Make sure to change my_user_name to your username. Also the first two paths (/usr/lib/php:/usr/local/lib/php) should remain so that the default PHP libraries are loaded.

This php.ini file must be put in each directory where pear packaegs are needed.

From this point on the Calendar Pear package will be available with the fixed path:

include 'Calendar/Calendar.php';

Of course, you could just place the Calendar.php in a directory and include it directly. This way you will end up with many hardcoded paths and confusion will be increased in case you plan to use more Pear packages.

Following the above steps you can install other Pear packages and benefit from using static paths.

Please, feel free to contact us if you have any questions or recommendations about this tutorial at: tutorials 'at' siteground.com



FTP Hosting
(c) Copyright 2007 SiteGround Web Hosting Provider. All rights reserved