Page 1 of 1
File Access
Posted: Tue Apr 28, 2009 8:15 am
by MbahGondrong
How can I access file in other folder in a php file in linux? what is the correct syntax?
It looks different than windows syntax.
Thanks.
Re: File Access
Posted: Thu Apr 30, 2009 12:02 am
by jaoudestudios
It should be very similar, apart from windows is more flexible with forward/back slash where linux only accepts a forward slash. You can access your file relatively.
i.e. include('your/file.php');
Re: File Access
Posted: Thu Apr 30, 2009 2:13 am
by MbahGondrong
I already tried using normal syntax but it keeps getting error when tested in browser.
The problem is, the php file is on a folder named generator, it used 2 include TConnection.php and class.file.php which is located in the parent folder from generator.
So normally I used something like this right:
include ('../TConnection.php');
include ('../class.file.php');
Is this correct?
Re: File Access
Posted: Thu Apr 30, 2009 6:04 am
by jaoudestudios
Yep that looks good.
Try the absolute path.
i.e. /var/www/vhosts/domain/htdocs/yourfile.php
Re: File Access
Posted: Thu Apr 30, 2009 1:34 pm
by MbahGondrong
Alright, gonna try it then.