Re: GD::Graph problem help much appreciated
by thezip (Vicar) on Jan 25, 2008 at 23:23 UTC
|
You'll need to specify that physical path as it relates to the file system, rather than the webserver's concept of document_root.
Try specifying an explicit path as a destination to prove this, "/tmp/foo.$format" for example.
Your wish is my commandline.
| [reply] |
Re: GD::Graph problem help much appreciated
by Errto (Vicar) on Jan 25, 2008 at 23:23 UTC
|
Well, first of all you've done the first step which is checking the actual error that your code is throwing, so that puts you a bit ahead of the game.
A permission denied probably error means one of two things:
- you don't have write access to the directory you're trying to write to
- you're trying to access the wrong directory
The first one could be the case if your CGI program is running as a different user than you're expecting. You can check this by printing out the user ID (though don't do this in production code!). The second one could be the case if the current directory is not where you expect it to be. Specifically, just because your code is in /var/www/cgi-bin does not necessarily mean that /var/www/cgi-bin is the current directory when your code runs. You can work around this by hard-coding the absolute path of the directory or fetching it from some kind of configuration variable.
| [reply] |
Re: GD::Graph problem help much appreciated
by LinuxNoobPhilip (Novice) on Jan 25, 2008 at 23:40 UTC
|
/tmp/foo
worked just great.
I guess there are some followup questions.
1. what user does the browser use? is it the one I log into at terminal with?
2. what would be a good folder to put the images in?
it appears no where in the /var/www area may I do this in ....
| [reply] |
|
1.I think you mean "What user does the server use?". Assuming that it is apache then ps -ef | grep http will show you the owner of the process.
2. You will need to ask your system administrator but a directory somewhere under your home directory is probably a safe bet. You will need to ensure that the web server can write there by changing the group and giving group write permission.
| [reply] [d/l] |
|
Well This is my set-up on my local machine, I guess I need to know how to change the group permissions then. Write now I can only get files in my www directory a subdirectories to work in the browser.
What you are saying is there is a way to tell apache it can look in a directory back and pull from a folder there? if so what would be the step.
| [reply] |
|
Re: GD::Graph problem help much appreciated
by LinuxNoobPhilip (Novice) on Jan 26, 2008 at 00:34 UTC
|
http://www.usenet-forums.com/apache-web-server/11734-allowing-cgi-script-create-write-directory.html
this link looks like what i am trying to do. What is the best way to get my CGI-Script to write to a file/folder which one of my web pages in my /var/www directory can access. (I am running apache2) | [reply] |
Re: GD::Graph problem help much appreciated
by LinuxNoobPhilip (Novice) on Jan 25, 2008 at 23:44 UTC
|
The site will not load the picture located in /temp directory, it seems :( | [reply] |
Re: GD::Graph problem help much appreciated
by leighsharpe (Monk) on Jan 26, 2008 at 12:34 UTC
|
You need to create the image files in a directory that is in your web site's document root. Your last comment indicates that it is probably in /var/www. Therefore, if you create a folder in /var/www, and call it, say, 'graph_files', then you want to write your image files to /var/www/graph_files, and then when you send your web page to the browser, the image tag should be <img src="graph_files/<filename>"> | [reply] |