views:

39

answers:

2

So I had an issue last night when I went to upload a project I've been working on locally to my server.

I had this:

require_once "/../controllers/source/MySpaceID/myspace.php";

Which is the correct path to that file finding its way out of the libraries folder. It worked fine until I put it on the server. Any thoughts?

+1  A: 

Echo you current working directory on the server ( echo getcwd(); ) and check your path from there, that's probably where your problem lies.

It sounds strange to me that CI would use ./library as its working directory - unless you set it yourself.

Note that you should use code igniter's APPPATH constant to create absolute paths instead of using relative ones, this will make things easier for you on the long term.

Lepidosteus
Well I just calling a library to do something. Perhaps that library should have actually been a controller. I'm new to CI so maybe that APPPATH will fix it.
Bobby
Just to let you know, APPPATH did what I needed it to do.Thanks!
Bobby
In that case please upvote my answer and select it as the valid answer
Lepidosteus
A: 

Lepidosteus is correct. Your library should live in /application/library/ and you should require it like this require_once APPPATH.'/libraries/MySpaceID/myspace.php'

Zack