Re: [sqlite] question about php_pdo_sqlite

2006-06-04 Thread yuyen

Thank you, DJ
My Apache is installed in Windows XP( run on NTFS file system). I think the 
user setting in the way as you said would be only available in Windows 
2000/2003. I did try to create a new user in the XP , but have nothing to 
set the account right except andministrator or normal user.


Jack
- Original Message - 
From: "DJ Anubis" <[EMAIL PROTECTED]>

To: 
Sent: Saturday, June 03, 2006 5:00 PM
Subject: Re: [sqlite] question about php_pdo_sqlite



Did you fully read Apache documentation ? Maybe some RTFM can help with
this.

From Apache doc, section Running Apache as a service on Windows:

"By default, all Apache services are registered to run as the system
user (the LocalSystem account). The LocalSystem account has no
privileges to your network via any Windows-secured mechanism, including
the file system, named pipes, DCOM, or secure RPC. It has, however, wide
privileges locally."

This explains the problem you face. Apache is more secured than most
Windows services. There is a simple solution which will give you write
access to your remote file system:

Create a separate account for running Apache services. This is mandatory
to access network resources. Simple steps:

  1. Create a normal domain user account, and memorize (write doiwn)
 its password.
  2. Grant the newly created account a Logon privilege as a service and
 Act as part of the OS. You'll have to use Group Policy to
 propagate those settings.
  3. Confirm the new account as a member of the Users Group
  4. Grant this account Read and Execute rights to all documents and
 folders (including subfolders) in your Apache Root Directory
 (htdocs and cgi-bin)
  5. Grant this account Change (RWXD) rights to Apache logs folder.
  6. Grant the account Read and Execute (RX) rights to Apache binary.

Then stop and restart Apache Services. You should have access to your
network mounts, providing your scripts use the standard:
  \
instead of the classic
  :\\\


This should solve all of your access rights assignations between your
PHP script, Apache and the network mount.

If this can help, let us know :)

JCR






Re: [sqlite] question about php_pdo_sqlite

2006-06-03 Thread Clay Dowling
yuyen wrote:
> Ok, finally I found the problem is that the PHP and Apache are installed
> in local drive and I put the sqlite database file on a remote file
> server which is a Linux / Samba. I can use sqlite3.exe to open that
> remote database with a mapped remote drive. And Insert, Update and
> Delete have no problem with it. While with Apache and PHP pdo, if the
> database is concurrently opened by sqlite3.exe, it will report "can't
> not open database". Close sqlite3.exe, then PHP pdo can open it, but it
> open as read-only. If I put the database file in local dirve, then there
> is no any problem at all. Even I can use sqlite3.exe concurrently with
> PHP pdo. Does Apache has different thinking about remote server?

SQLite has issues with remote servers.  It's entirely dependent upon the
network file system's file locking mechanism, which tends to be
something of a blunt instrument.  It's also somewhat unpredictable.
You'll be best off to keep the file on a local drive.  If you need
access from multiple servers a database engine with a network server
daemon is going to be a better choice.  PostgreSQL comes highly
recommended, as do several others.

Clay
-- 
CeaMuS
http://www.ceamus.com
Simple Content Management


Re: [sqlite] question about php_pdo_sqlite

2006-06-03 Thread DJ Anubis
yuyen wrote:
> Ok, finally I found the problem is that the PHP and Apache are
> installed in local drive and I put the sqlite database file on a
> remote file server which is a Linux / Samba. I can use sqlite3.exe to
> open that remote database with a mapped remote drive. And Insert,
> Update and Delete have no problem with it. While with Apache and PHP
> pdo, if the database is concurrently opened by sqlite3.exe, it will
> report "can't not open database". Close sqlite3.exe, then PHP pdo can
> open it, but it open as read-only. If I put the database file in local
> dirve, then there is no any problem at all. Even I can use sqlite3.exe
> concurrently with PHP pdo. Does Apache has different thinking about
> remote server?
>
> Jack
Did you fully read Apache documentation ? Maybe some RTFM can help with
this.
>From Apache doc, section Running Apache as a service on Windows:
"By default, all Apache services are registered to run as the system
user (the LocalSystem account). The LocalSystem account has no
privileges to your network via any Windows-secured mechanism, including
the file system, named pipes, DCOM, or secure RPC. It has, however, wide
privileges locally."

This explains the problem you face. Apache is more secured than most
Windows services. There is a simple solution which will give you write
access to your remote file system:

Create a separate account for running Apache services. This is mandatory
to access network resources. Simple steps:

   1. Create a normal domain user account, and memorize (write doiwn)
  its password.
   2. Grant the newly created account a Logon privilege as a service and
  Act as part of the OS. You'll have to use Group Policy to
  propagate those settings.
   3. Confirm the new account as a member of the Users Group
   4. Grant this account Read and Execute rights to all documents and
  folders (including subfolders) in your Apache Root Directory
  (htdocs and cgi-bin)
   5. Grant this account Change (RWXD) rights to Apache logs folder.
   6. Grant the account Read and Execute (RX) rights to Apache binary.

Then stop and restart Apache Services. You should have access to your
network mounts, providing your scripts use the standard:
   \
instead of the classic
   :\\\


This should solve all of your access rights assignations between your
PHP script, Apache and the network mount.

If this can help, let us know :)

JCR



Re: [sqlite] question about php_pdo_sqlite

2006-06-02 Thread yuyen
Ok, finally I found the problem is that the PHP and Apache are installed in 
local drive and I put the sqlite database file on a remote file server which 
is a Linux / Samba. I can use sqlite3.exe to open that remote database with 
a mapped remote drive. And Insert, Update and Delete have no problem with 
it. While with Apache and PHP pdo, if the database is concurrently opened by 
sqlite3.exe, it will report "can't not open database". Close sqlite3.exe, 
then PHP pdo can open it, but it open as read-only. If I put the database 
file in local dirve, then there is no any problem at all. Even I can use 
sqlite3.exe concurrently with PHP pdo. Does Apache has different thinking 
about remote server?


Jack

- Original Message - 
From: "DJ Anubis" <[EMAIL PROTECTED]>

To: 
Sent: Friday, June 02, 2006 12:13 AM
Subject: Re: [sqlite] question about php_pdo_sqlite



yuyen wrote:

And the error message is:
"execute err: SQLSTATE[HY000]: General error: 8 attempt to write a
readonly database"

So the problem is why the database becomes read only.


This time, you get another message :)
Are you sure the Web Server user (Apache or...) has write access to your
sqlite database file ?





Re: [sqlite] question about php_pdo_sqlite

2006-06-01 Thread DJ Anubis
yuyen wrote:
> And the error message is:
> "execute err: SQLSTATE[HY000]: General error: 8 attempt to write a
> readonly database"
>
> So the problem is why the database becomes read only.
>
This time, you get another message :)
Are you sure the Web Server user (Apache or...) has write access to your
sqlite database file ?



Re: [sqlite] question about php_pdo_sqlite

2006-06-01 Thread yuyen

Hi, DJ

I try the following code:
--
try{
$dsn = 'sqlite:counter/cntdata.sq3';
$myConn = new PDO($dsn);
$myConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$j = $myConn->exec('update test_item set balqty = 100');
}catch (PDOException $e){
 die('execute err: '.$e->getMessage());
}
print("$j records are done!");
--
And the error message is:
"execute err: SQLSTATE[HY000]: General error: 8 attempt to write a readonly 
database"


So the problem is why the database becomes read only.

Jack 



Re: [sqlite] question about php_pdo_sqlite

2006-06-01 Thread DJ Anubis
yuyen wrote:
> HI, JC
> I use php_do_sqlite with PHP 5.1.4 and Sqlite 3.2.8 on Windows XP. The
> following is my coding:
>
>  try{
> $dsn = 'sqlite:counter/cntdata.sq3';
> $myConn = new PDO($dsn);
> $myConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
>
> $myPre = $myConn->prepare('update test_item set balqty = 100');
> $myPre->execute();
> }catch (PDOException $e){
>  die('execute err: '.$e->getMessage());
> }
> print('done!');
> ?>
> -
> And the error is:
> execute err: SQLSTATE[HY000]: General error: 1 SQL logic error or
> missing database
>
> -
> Would you please have a look and give me an advise. Thank you!
>
>
> Jack
>

Not having a windows box at hand, I can only guess things :)
But, if I remember (and sounds like this in PDO code) dns is passed as
is, so for windows, your dsn should be:
$dsn = 'sqlite:counter\\cntdata.sq3';
or, if you want a really portable way:
$dsn = 'sqlite:counter' . DIRECTORY_SEPARATOR . 'cntdata.sq3';

JC




Re: [sqlite] question about php_pdo_sqlite

2006-06-01 Thread Kevin Waterson
This one time, at band camp, "yuyen" <[EMAIL PROTECTED]> wrote:

> HI, JC
> I use php_do_sqlite with PHP 5.1.4 and Sqlite 3.2.8 on Windows XP. The 
> following is my coding:

-8< snip

try { 
$dbh = new PDO("sqlite:counter/cntdata.sq3"; 
/*** echo a message saying we have connected ***/ 
echo 'Connected to database'; 

/*** set the PDO error mode to exception ***/ 
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
 
/*** our sql statement ***/ 
$sql = 'UPDATE test_item SET balqty = 100'; 

/*** we use PDO::exec because no results are returned ***/ 
$dbh->exec($sql); 

/*** give praise and thanks to the PHP/SQLite gods ***/ 
echo 'Item updated successfully'; 
} 
catch(PDOException $e) 
{ 
/*** echo the sql statement and error message ***/ 
echo $sql . '' . $e->getMessage(); 
} 
?>

Kevin

-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."


Re: [sqlite] question about php_pdo_sqlite

2006-05-31 Thread yuyen

HI, JC
I use php_do_sqlite with PHP 5.1.4 and Sqlite 3.2.8 on Windows XP. The 
following is my coding:


setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$myPre = $myConn->prepare('update test_item set balqty = 100');
$myPre->execute();
}catch (PDOException $e){
 die('execute err: '.$e->getMessage());
}
print('done!');
?>
-
And the error is:
execute err: SQLSTATE[HY000]: General error: 1 SQL logic error or missing 
database


-
Would you please have a look and give me an advise. Thank you!


Jack


- Original Message - 
From: "DJ Anubis" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, June 01, 2006 4:03 PM
Subject: Re: [sqlite] question about php_pdo_sqlite



yuyen wrote:

Hi, all

I try to use php_pdo_sqlite in php which is a sqlite of version 3.2.8. 
With php_pdo, it provides PREPARE and EXECUTE functions to prepare an sql 
at first then which can execute later. But it seems that the 
php_pdo_sqlite.dll doesn't support it. Or I may do somthing wrong. If 
there is anyone who has the experience, please give me an advice. Thank 
you!



Jack


Hi Jack,

I use php_do_sqlite too, with PHP 5.1.4 and SQlite 3.2.8, Linux build.
Prepare and Execute methods work well, but I remeber some problems with
PHP 5.0.4 builds.

JC





Re: [sqlite] question about php_pdo_sqlite

2006-05-31 Thread DJ Anubis
yuyen wrote:
> Hi, all 
>
> I try to use php_pdo_sqlite in php which is a sqlite of version 3.2.8. With 
> php_pdo, it provides PREPARE and EXECUTE functions to prepare an sql at first 
> then which can execute later. But it seems that the php_pdo_sqlite.dll 
> doesn't support it. Or I may do somthing wrong. If there is anyone who has 
> the experience, please give me an advice. Thank you!
>
>
> Jack
>   
Hi Jack,

I use php_do_sqlite too, with PHP 5.1.4 and SQlite 3.2.8, Linux build.
Prepare and Execute methods work well, but I remeber some problems with
PHP 5.0.4 builds.

JC



[sqlite] question about php_pdo_sqlite

2006-05-31 Thread yuyen
Hi, all 

I try to use php_pdo_sqlite in php which is a sqlite of version 3.2.8. With 
php_pdo, it provides PREPARE and EXECUTE functions to prepare an sql at first 
then which can execute later. But it seems that the php_pdo_sqlite.dll doesn't 
support it. Or I may do somthing wrong. If there is anyone who has the 
experience, please give me an advice. Thank you!


Jack