Set Include folder for Godaddy hosting

by reenadak on 2009 Nov 07

in PHP

Below are the instructions for setting up include folder for your website. These instructions are applicable for most cases but this is tested successfully for Godaddy shared hosting account. Here are step by step instructions.

1. Access the root folder of your site using ftp.

2. Now create a folder in root directory, name it phpinclude or whatever you wish.

3. Now create a blank test file on your desktop named path.php and write following code in this file

<?php
    $path = "path.php";
   echo realpath($path);
?>

and upload this path.php to your newly created phpinclude folder

4. now you access this file path.php using your browser and you will see something like this

/home/content/p/e/a/pearl/html/phpinclude

5. Note down this path and open your php.ini ( or php5.ini whatever applicable ) for editing.

6. If you don’t know how to access your php.ini file then refer this article http://dak.me/edit-php-ini-file-for-godaddy-hosting-account/

7. Now here add a line like this

include_path = "/home/content/p/e/a/pearl/html/phpinclude"

here change this path to the path what you got by executing path.php, now save this file.

8. If you already have a line there like

include_path =.:/usr/local/php5/lib/php

then you can add your new folder name as

include_path = ".:/usr/local/php5/lib/php:/home/content/p/e/a/pearl/html/phpinclude"

i.e. you will have to seperate folder’s full path with colon(:) and put whole right part under inverted comma.

9. Congratulations!, you have successfully setup your include folder, and now you can delete your path.php file, as we no longer need it.

Leave a Comment

Previous post:

Next post: