0

I have made a .php file that produces a graph and it shows perfect when run from localhost. When I put it in my web-folder /var/www/"my-dyndns-web-adress.com"/web/ I get a blank page (my-dyndns-web-adress is fake instead of my real one).

From tail -f other_vhosts_access.log I am getting this:

my-dyndns-web-adress.com:80 XX.XXX.XXX.XXX - - [01/Sep/2012:15:31:37 +0200]
  "GET /sqlex.php HTTP/1.1" 500 275 "-" "Mozilla/5.0
  (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.25 (KHTML, like Gecko)
  Version/6.0 Safari/536.25"

It appears to be some sort of HTTP error, but I don't know how to address that, have googled with no luck.

I have traced it to crash just when the first $graph = something shall execute. Before that there are no problems.

Sicco
  • 6,167
  • 5
  • 45
  • 61
  • 1
    You should enable error reporting in your php script to see what the error is. Just put this at the top: `ini_set('display_errors',1); error_reporting(E_ALL | E_STRICT);` – jeroen Sep 01 '12 at 13:46
  • 1
    Its a 500 internal server error, tho without seeing code or error line, its impossible to answer. could be many things. – Lawrence Cherone Sep 01 '12 at 13:52
  • Thanks jeroen, that was what I was looking for. Now I know what the problem is: Warning: include(): open_basedir restriction in effect. File(/usr/share/jpgraph/jpgraph.php) is not within the allowed path(s): – Ralph Hoglund Sep 01 '12 at 14:44
  • This is in the beginning of my file: – Ralph Hoglund Sep 01 '12 at 14:47
  • Now, I have installed the libraries within my web area (lib) and no errors comes as before so it finds the jpgraph libraries. But now I am getting only a little blue square with question mark from jpgraph, something is happening but no graphic. – Ralph Hoglund Sep 01 '12 at 15:59
  • AT LAST! Thanks for the tips, I had an echo "line 2"; in the beginning - not allowed! Now it works like charm. Have a nice day/evening/morning what suits best. Regards, Ralph in Sweden – Ralph Hoglund Sep 01 '12 at 16:09

1 Answers1

0

To answer your question about where to put your included files: an .htaccess file will only have effect if the files are within the web-root.

I normally put my includes inside the php include directory (set in the ini file, include_path) if they are shared by multiple sites or in the project directory outside the web-root when they are for that specific project only (my project directory normally contains folders like /sys and /www where /www is the web-root).

jeroen
  • 91,079
  • 21
  • 114
  • 132