Bonjour,
Je souhaite pour développement personnel créer et utiliser une base sqlite3.
Je travaille sur une VM centos7 avec un php 5.4.16
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 [root@localhost www]# uname -a Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/LinuxJ'ai un certain nombre de processus apache qui tournent, l'un appartient à root, les autres à apache
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 [root@localhost ~]# cd /var/www [root@localhost www]# ls -la total 8 drwxr-xr-x. 4 apache root 31 28 oct. 17:17 . drwxr-xr-x. 21 root root 4096 1 nov. 17:57 .. drwxr-xr-x. 2 apache root 6 23 juil. 16:48 cgi-bin drwxr-xr-x. 8 apache root 4096 1 nov. 17:22 html
La configuration sqlite3 au niveau de php reste minimale :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 [root@localhost www]# ps -edf | grep httpd root 1242 1 0 nov.01 ? 00:00:03 /usr/sbin/httpd -DFOREGROUND apache 1394 1242 0 nov.01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 1395 1242 0 nov.01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 1396 1242 0 nov.01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 1397 1242 0 nov.01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 2473 1242 0 00:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 2474 1242 0 00:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 2475 1242 0 00:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 2476 1242 0 00:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 2477 1242 0 00:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 2478 1242 0 00:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND root 2509 2483 0 00:41 pts/0 00:00:00 grep --color=auto httpd
Lorsque j'exécute le script suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 [sqlite3] ;sqlite3.extension_dir =
J'obtiens le résultat suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 [root@localhost html]# ls -l sqlite* -rw-r--r--. 1 apache root 251 1 nov. 16:17 sqlite.php <?php error_reporting(E_ALL); if ( class_exists('SQLite3') ) { echo 'Sqlite3 PHP class loaded<br />'.chr(10); } else { die ('Sqlite3 PHP class NOT loaded'); } $db=new SQLite3('toto.sq3') or die ('Cannot open toto.sq3'); echo "END OF TEST" ?>
J'aimerais bien sûr pouvoir créer ma base de données. Mais au delà de ce souci, lorsque j'alimente une base que j'ai déja créée, ce sont les erreurs suivantes qui sortent :Sqlite3 PHP class loaded
Fatal error: Uncaught exception 'Exception' with message 'Unable to open database: unable to open database file' in /var/www/html/sqlite.php:11 Stack trace: #0 /var/www/html/sqlite.php(11): SQLite3->__construct('toto.sq3') #1 {main} thrown in /var/www/html/sqlite.php on line 11
Le script est un peu plus long, mais l'erreur ne vient pas du SQL, il fonctionne parfaitement sur windows (sic !)Warning: SQLite3::exec(): attempt to write a readonly database in /var/www/html/ajax/dbLogon.php on line 108
Warning: SQLite3::exec(): attempt to write a readonly database in /var/www/html/ajax/dbLogon.php on line 117
insert or replace into appl$ ( r_user , appl , srvc , host , port , user , pswd ) values ('admin', 'toto titi', 'ojotst', '192.168.0.13', 1521, 'system', 'bWFuYWdlcjEx' ) Error saving DB credentials: Error saving DB parameters:
Avez vous des idées sur l'origine de l'erreur ?
Vous remerciant par avance
Partager