I'm trying to get my project running on Dancer (perl 5.16.3 and centos 5.10), and so far it was pleasant experience - until I tried to deploy it on server.
I've decided to do the simplest thing and run it as CGI app with help of default dispatch.cgi script from Dancer distribution.
I used default apache settings from Dancer::Deployment manual, but something went wrong. After a day of struggle with half-working project I deduced the following strange thing: while running through dispatch.cgi, my project is able to read from sqlite database, but it cannot write into database, so Dancer::Session::DBI was not working properly and hence the problems.
If I run the project with stand-alone app.pl or with
plackup -E production -p 80 bin/app.pl
it works fine and able to insert data into DB. I've tried to change permissions to 0666 on sqlite db file, but it didn't help.
So why there's a problem with sqlite while running as CGI, and how to fix this?
cgithe script is using your web-server's user and not the owner of the script and that user will need to have read/write access to the sqlite db file. Allow apache read/write permissions to the SQLite file and you should be all set. - MattSizzle