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.
File Access
Moderator: General Moderators
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: File Access
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');
i.e. include('your/file.php');
-
MbahGondrong
- Forum Newbie
- Posts: 7
- Joined: Wed Apr 22, 2009 2:37 pm
Re: File Access
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?
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?
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: File Access
Yep that looks good.
Try the absolute path.
i.e. /var/www/vhosts/domain/htdocs/yourfile.php
Try the absolute path.
i.e. /var/www/vhosts/domain/htdocs/yourfile.php
-
MbahGondrong
- Forum Newbie
- Posts: 7
- Joined: Wed Apr 22, 2009 2:37 pm
Re: File Access
Alright, gonna try it then.