博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
php mysql exec_PHP: PDO::exec - Manual
阅读量:6361 次
发布时间:2019-06-23

本文共 1070 字,大约阅读时间需要 3 分钟。

I spent half a day trying to work out why I could not update my sqlite3 database from apache using the PHP PDO driver. I was getting NO error messages at all.

I could connect and select data, but not modify it.

It wasn't until I added the following line:

$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);

after immediately opening the database, that I got a hint of what was happening.

filename: File3

dl_count: 100

( ! ) Warning: PDO::exec() [pdo.exec.html]: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /www/htdocs/test/dl-counter/sqlite-readwrite-test.php on line 76

Call Stack

#

Time

Memory

Function

Location

1  0.0086  330120  {main}( )  ../sqlite-readwrite-test.php:0

2  0.0273  331240  PDO->exec( )  ../sqlite-readwrite-test.php:76

Affected Rows: ''

filename: File3

dl_count: 100

The problem was with the file permissions. As root I could read and write the database from the sqlite3 command line monitor. But Apache was unable to write the database.

Changed the permissions to 755 wwwrun:wwrun and it all works OK!

Thanks again :)

转载地址:http://yjima.baihongyu.com/

你可能感兴趣的文章
AS开发JNI步骤
查看>>
二分查找,php
查看>>
Python——eventlet.greenthread
查看>>
记大众点评之面试经历
查看>>
第三章:基本概念
查看>>
Jersey+mybatis实现web项目第一篇
查看>>
C++形参中const char * 与 char * 的区别
查看>>
espresso 2.0.4 Apple Xcode 4.4.1 coteditor 价格
查看>>
Object-C中emoji与json的问题
查看>>
linux 命令
查看>>
灾后重建
查看>>
Nothing 和 Is
查看>>
第一个sprint冲刺第三天
查看>>
r 选取从小到大的数据_r 选取数据库
查看>>
springMVC3学习(九)--redirect和forward跳转
查看>>
Spark技术栈
查看>>
EGLImage与纹理
查看>>
Redis(七):Jedis简介和集群
查看>>
Web API 持续集成:PostMan+Newman+Jenkins(图文讲解)
查看>>
证书生成加密码解密
查看>>