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:
   \\<NetworkShareName>\<Directory>\<SubDirectory>\<Filename_or_SQlite_Db>
instead of the classic
   <Drive>:\<Directory>\<SubDirectory>\<Filename_or_SQlite_Db>


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

Reply via email to