On 07/24/2010 10:48 AM, Owen wrote: > >> On 07/24/2010 08:53 AM, Owen wrote: >> >>> >>>> hi, >>>> it got some error while adding data into sqlite through Perl script >>>> on >>>> Apache ... script can able to read the file but not able to write >>>> .. I >>>> have set the permissions of sqlite file to 666 .. >>>> >>>> when i ran the script from local user its working fine .. its able >>>> to >>>> write the data into db >>>> when i rant that script on Apache its not working .. >>>> i can't figure it out >>>> its is a Apache error or my file permissions? >>>> thank you. >>>> Kanishka >>>> >>>> >>> >>> >>> >>> You actually need to provide a little more information. >>> >>> Do you have this line in your cgi script? If not, put it in. >>> >>> use CGI::Carp qw (fatalsToBrowser); >>> >>> The error message from that will give you some clues. >>> >>> >>> Do you have access to the apache(2) logs? If so, read them and see >>> what they say >>> >>> >> This is the Error .. got from Apache ... >> DBD::SQLite::db do failed: unable to open database file at >> >> #!/usr/bin/perl >> use strict; >> use Net::OAuth; >> use LWP::UserAgent; >> use CGI; >> use DBI; >> use XML::LibXML; >> use YAML; >> my $xpc = XML::LibXML::XPathContext->new(); >> use Data::Random qw(:all); >> my $cgi = CGI->new; >> print $cgi->header(); >> my $id = $cgi->param('id'); >> my $count = $cgi->param('count'); >> my $screen = $cgi->param('screen'); >> $Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A; >> use HTTP::Request::Common; >> my $i; >> my $dbh = >> DBI->connect("dbi:SQLite:dbname=info.sqlite","","",{AutoCommit >> => 1 })||die(print "$DBI::err $DBI::errstr \t $DBI::state 1 "); >> $dbh->do("INSERT INTO list VALUES >> ('$id','$screen','$count')")||die(print "$DBI::err $DBI::errstr >> $DBI::state 2"); >> $dbh->do("CREATE TABLE $screen ( created TEXT, id NUMERIC, source >> TEXT, >> text TEXT )")||die(print "$DBI::err $DBI::errstr 3"); >> >> > > > > > Where you have DBI->connect("dbi:SQLite:dbname=info.sqlite" ... i > would have; > > made a variable; > my $db = '/full/path/to/info.sqlite'; then said > DBI->connect("dbi:SQLite:$db" .... > > I suspect the the server is looking for the database somewhere else > > Ahh Solved its about the permissions of the Folder not the sever fault ... i have to give write permission of the folder to WWW .... Thank's for the help Kanishka
-- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/