• dt

    I don’t get it. Why don’t you put your library directly in your home directory, above public_html?

    /home/{your-username}/library/

  • Because if you rename the public_html folder to public, to comply with Zend Framework’s directory structure, the server won’t work.

    You can hack the Framework and force it to use a public_html folder instead of a public folder (have a look into Zend/Controller/Front.php and Zend/Controller/Request/Http.php) but that’s generally a bad idea. A lot of people expect the /public/ directory to be there and you might have “surprises” with 3rd party components that also expect a /public/ folder. I’ve seen a component that was looking for a path like /public/images/avatars/ to save the user’s avatar. These kind of components will also need to be re-written.

    Another idea is to delete the /public_html/ folder as it is and create a symlink in its place, from /public_html/ (where the server want the document root) to /public/ (where the framework wants the document root). But since most hosting company don’t provide a shell account, I don’t know if you can do this with FTP alone. Any help will be appreciated 🙂

    The solution with .htaccess files is the simplest I’ve seen so far and won’t mess around with other plugins’ functionalities.

  • dt

    Ok, I see. You can’t remove public_html because this will break the apache configuration but you can create a symlink “public” to point to public_html Symlink can be created without shell, from a cgi script. Or, a quickfix from FTP: just rename www into public (www is a precreated symlink to public_html). I test it and it works. Anyway, if you cannot create it, just ask your provider :P)

  • I prefer the easy way: adding a few .htaccess files here and there, as it works right out the box, no need to rename anything or bother the hosting company with requests.

    I usually bother my provider with stuff like “can you open port xyz in the firewall”, or “quick, give me last night’s backup”. I think “he” hates me 🙂

    But, of course, you already know that 🙂

  • On the other hand those .htaccess files do create a little overhead for the server compared to not using them… But you can create symlinks by placing a cronjob in Cpanel. 😉

  • The overhead is minimal…the only “heavily used” .htaccess will be the one placed directly in the “public_html” folder which redirects all the traffic to the /public/ sub-folder

  • Pingback: Zend Framework and web hosting services :: Zend Framework on … « Blogging()

  • joseph

    Hi i’ve just tried this method and i got error 500 The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@xxxx.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Any Idea? thanks

  • I have used the .htaccess technique but a 500 error raised telling me that there is a miss configuration in the .htaccess file. can anyone tell me the reason

  • hi,

    i have used same steps but i m getting ,

    please can you help me ….

  • Loyiso

    Seems most of the comments are positive, I think I will try this .htaccess method. Forgive me if this is a stupid question but I must ask, what about the ZendFramework Library? When setting up ZendFramework on the local machine, a lot of emphasis is put on include_path and including the /library/ folder.. how does this work on CPanel?

  • Sorry mate, I don’t use CPanel anymore. This is a really old post, from 2009 🙂 I run my own servers on Amazon.

  • worked like a charm… thanks man

Advertisment ad adsense adlogger