LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-24-2009, 03:27 AM   #1
KeenAs
LQ Newbie
 
Registered: Oct 2006
Location: Melbourne
Distribution: Ubuntu Server 8.10
Posts: 21

Rep: Reputation: 15
Question Ubuntu - LAMP > PHP path to require_once / include_once not being found


Hello LQ'ppl,


I am running "Ubuntu Server with LAMP" which is working well bu for some reason i'm having trouble with paths being found by PHP; for instance:


if(file_exists("../db/websitedb.php")) require_once("../db/websitedb.php");

returns false: file not found!

if i put in an absolute path to the server in a php file like "/var/www/db/websitedb.php" it finds the file as i would hope to in the first instance.


Is there a settings in the php.ini that i have changed or missed that will fix this? or is there a module that needs to be installed for it to work properly?

I don't have this problem with other linux servers used for web hosting for my clients, and apache/php in windows is fine also, so it seems strange that this isn't working under Ubuntu Server using LAMP.


Hoping someone can help...
 
Old 03-25-2009, 02:23 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,945

Rep: Reputation: 8017Reputation: 8017Reputation: 8017Reputation: 8017Reputation: 8017Reputation: 8017Reputation: 8017Reputation: 8017Reputation: 8017Reputation: 8017Reputation: 8017
Quote:
Originally Posted by KeenAs View Post
Hello LQ'ppl,


I am running "Ubuntu Server with LAMP" which is working well bu for some reason i'm having trouble with paths being found by PHP; for instance:


if(file_exists("../db/websitedb.php")) require_once("../db/websitedb.php");

returns false: file not found!

if i put in an absolute path to the server in a php file like "/var/www/db/websitedb.php" it finds the file as i would hope to in the first instance.


Is there a settings in the php.ini that i have changed or missed that will fix this? or is there a module that needs to be installed for it to work properly?

I don't have this problem with other linux servers used for web hosting for my clients, and apache/php in windows is fine also, so it seems strange that this isn't working under Ubuntu Server using LAMP.


Hoping someone can help...
Check the permissions on the directory tree, and the entire relative path too. Be sure that you can go into the docroot where the file that's calling websitedb.php is, and type in "cd ../db" successfully. If you can't, that'll cause this. Also, is that directory a symbolic link? If so, you've got to have Apache set up to follow symlinks, otherwise it will fail.

There's nothing you need to change in php.ini...you've either got a permissions, symlink, or path problem.
 
Old 03-26-2009, 09:08 AM   #3
KeenAs
LQ Newbie
 
Registered: Oct 2006
Location: Melbourne
Distribution: Ubuntu Server 8.10
Posts: 21

Original Poster
Rep: Reputation: 15
Thanks for the reply TB0ne,

Permssions on all directorys under and including 'www' are 755 drwxr-xr-x

directory tree looks like:

www
---db
---public_html
--------------anywebsite

I have no problems changing directorys from the calling scripts directory e.g
from anywebsite i can 'cd ../../db' to the db directory.

The 'db' directory is a physical directory

Last edited by KeenAs; 03-26-2009 at 09:10 AM. Reason: multiple spaces don't show
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LAMP config glitch. dubbel slash in path /var/www//docs/... bmarien Linux - Server 2 01-18-2009 10:08 AM
Warning: and Fatal error require_once(../wp-config.php) [function.require-once] jouvert Linux - Newbie 3 06-25-2008 01:52 AM
PHP won't recognize my Configuration File (php.ini) path kriezo Programming 4 02-14-2008 02:31 AM
connecting PHP to MySQL in a LAMP server rickyglucas_143 Linux - Newbie 2 02-06-2006 04:02 AM
HTML/PHP problem, using LAMP AntWarrior Programming 2 11-27-2004 08:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration