WebFaction
Community site: login faq

Hey,

I'm building a small app with Codeigniter and I have the habit of keeping all the files except the index.php and the assets outside the document root. For example: I usually set the doc root to be /app_name/root and the framework's files and the app itself lies in /app_name. However when I create a static PHP app in webfaction's panel I can't set the document root, which is automatically set to /app_name/ Is there some way around this which is less cluttery :) I just like to keep all apps files in one directory and not two different dirs like "/app_name_root" and "/app_name".

I hope I explained myself ok :)

asked 05 Nov '10, 11:58

zbrox
8124
accept rate: 0%


I deploy PHP in a very similar fashion to you (only an index.php in the web root).

The best way of doing this is to:

  1. Upload your application somewhere in your home directory.
  2. Create a new 'symlink to PHP' application
  3. In the 'extra_info' field, place the path to your web root. E.g. '/home/{{user}}/my_app/public'
  4. Use the application in your sites as you normally would.

Hope this helps :)

permanent link

answered 05 Nov '10, 12:06

David L ♦♦
1.4k13
accept rate: 45%

Thanks, this never occured to my mind :)

(11 Apr '12, 07:28) Jazmo

Instructions for setting your PHP DOCUMENT_ROOT are available here: Setting PHP’s DOCUMENT_ROOT

Another approach would be to serve your app's root directory with a static/CGI/PHP symlink app.

Hope that helps!

permanent link

answered 05 Nov '10, 12:06

seanf
12.2k42136
accept rate: 37%

I had the same requirements and tried both solutions suggested above (symlink and document root) and finally discarded both of them.

It is enough to create an application for codeigniter code (both system and applications directories) and to not link it to any website. Then create a new static php application and link this one to the front-end website: on its root you will place just the CI's index file with inclusion paths to the codeigniter directories.

Since PHP runs with your account's permissions, you can access from any website the codeigniter application. In this way you can have also multiple websites accessing the same codeigniter code (one system folder and multiple applications folders), each of them with its own index file.

permanent link

answered 11 Apr '12, 13:40

robertotra
5721321
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×264
×6

question asked: 05 Nov '10, 11:58

question was seen: 11,362 times

last updated: 11 Apr '12, 13:40

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM