为什么 DBD::SQLite 不能通过我的 Perl CGI 脚本插入数据库? [英] Why can't DBD::SQLite insert into a database through my Perl CGI script?

查看:27
本文介绍了为什么 DBD::SQLite 不能通过我的 Perl CGI 脚本插入数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Perl CGI 脚本中运行 SQLite 数据库,该脚本由 DBD::SQLite 访问.这是在 Apache 上作为直接 CGI 运行的.

I am running a SQLite database within a Perl CGI script which is being accessed by DBD::SQLite. This is being run as a straight CGI on Apache.

DBI 连接工作正常并且可以运行选择.但是,当我尝试插入时,出现以下错误:

The DBI connection works fine and selects are able to be run. However, when I attempt to do an insert I get a die with the following error:

DBD::SQLite::st execute failed: unable to open database file(1) at dbdimp.c line 402 at index.cgi line 66

我已尝试将数据库文件权限更改为 666 以尝试解决此问题,但我仍然收到错误消息.

I have tried changing the database file permission to 666 to try to fix this however I am still receiving the error.

有什么建议吗?

推荐答案

看起来目录需要写权限,原因是:

It looks like the directory needs write permission, the reason is:

SQLite 需要能够在与数据库相同的目录中创建日志文件,然后才能进行任何修改.该日志用于支持事务回滚.

SQLite needs to be able to create a journal file in the same directory as the DB, before any modifications can take place. The journal is used to support transaction rollback.

来自:似乎需要对 db 的父目录的写权限

这篇关于为什么 DBD::SQLite 不能通过我的 Perl CGI 脚本插入数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆