CodeIgniter Forums

Full Version: local path
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]bralens[/eluser]
How can i get local path with folder?
Curently in constants.php file i have defined it like so
Code:
define('LOCAL_PATH', $_SERVER['DOCUMENT_ROOT'].'/my_project_root_folder/');

how can i replace '/my_project_root_folder/' so it be more flexible?

El Forum

[eluser]CroNiX[/eluser]
Create a virtual server in Apache so you don't need a subdirectory.

I create one for each project. It makes things a lot easier when everything is set up like the live project will be.

El Forum

[eluser]Samus[/eluser]
[quote author="CroNiX" date="1334603908"]Create a virtual server in Apache so you don't need a subdirectory.

I create one for each project. It makes things a lot easier when everything is set up like the live project will be.[/quote]
can you describe how you'd do this abit please?

El Forum

[eluser]bralens[/eluser]
[quote author="CroNiX" date="1334603908"]Create a virtual server in Apache so you don't need a subdirectory.

I create one for each project. It makes things a lot easier when everything is set up like the live project will be.[/quote]

Thats some thing new to me and first thing tomorrow: google.com

El Forum

[eluser]CroNiX[/eluser]
Something like this. You will probably have some things you need to change in your main httpd.conf to make this work (like telling it to load the httpd-vhosts.conf file), among others. I don't have everything written down that is necessary, so google is your friend here.

From: Apache_dir/conf/extra/httpd-vhosts.conf
Code:
<VirtualHost *>
    ServerAdmin [email protected]_host.com
    DocumentRoot D:/public_html/project_directory
    ServerName project_name.localhost
    ServerAlias project_name
    ErrorLog D:/public_html/project_directory/error_log
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
</VirtualHost>

So DocumentRoot is set to where this project is located (subdir of my public_html dir).
And, "project_name.localhost" or "project_name" is the url to access the local site in the browser, and also what you would enter in config.php for the base_url (http://project_name.localhost/) (or leave it blank).

El Forum

[eluser]Samus[/eluser]
[quote author="CroNiX" date="1334604875"]Something like this. You will probably have some things you need to change in your main httpd.conf to make this work (like telling it to load the httpd-vhosts.conf file), among others. I don't have everything written down that is necessary, so google is your friend here.

From: Apache_dir/conf/extra/httpd-vhosts.conf
Code:
<VirtualHost *>
    ServerAdmin [email protected]_host.com
    DocumentRoot D:/public_html/project_directory
    ServerName project_name.localhost
    ServerAlias project_name
    ErrorLog D:/public_html/project_directory/error_log
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
</VirtualHost>

So DocumentRoot is set to where this project is located (subdir of my public_html dir).
And, "project_name.localhost" or "project_name" is the url to access the local site in the browser.[/quote]
Thanks.

Does each project have to be wrapped in those <virtualhost> tags?

El Forum

[eluser]CroNiX[/eluser]
Yes

El Forum

[eluser]CroNiX[/eluser]
[quote author="bralens" date="1334604836"][quote author="CroNiX" date="1334603908"]Create a virtual server in Apache so you don't need a subdirectory.

I create one for each project. It makes things a lot easier when everything is set up like the live project will be.[/quote]

Thats some thing new to me and first thing tomorrow: google.com[/quote]This is how you basically set up shared hosting, making it possible to run many websites on the same server. This is what cPanel/Plesk, etc, do under the hood when creating a new domain.