Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-25 Thread Tijnema

On 5/24/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote:


You may have something here.
Problem is, I don¹t know how to mess with how  under what user Apache is
running ­ and no one else here does either so basically I have to figure
this one out! I would like to, as you suggested, try and ³get Apache to run
as a service under a user that can access the network resource².

I definitely agree about using non-mapped addresses and using the actual
Server Name addresses.


Ok, I don't know a lot of Apache  PHP under Windows, but did you try
to run the script through the PHP CLI? If you start your script
through the CLI it will run as the user you're currently working in,
so make sure you're logged in as Administrator, and then try running
it through the CLI. If you don't know how to do that, I believe you
should open a command line with start-run type cmd (without ) and
press enter. Then you should do a few cd commands to go to the actual
directory where php.exe is. Then you should type php.exe
C:/Full/Path/To/File.php

If it runs this way, then you're probably sure it is a permission
issue. I would recommend to use the code you posted on May 24, 2007
4:35 PM.

Tijnema



On 5/24/07 11:24 AM, Jared Farrish [EMAIL PROTECTED] wrote:

Are you running Apache under a different (non-privileged) account on the
Win2003 machine? If Apache is running as a service with a different username
(with no extended access to network resources), you will need to get Apache
to run as a service under a user that can access the network resource. And I
still think you should use non-mapped addresses instead of mapped addresses,
since a mapping is just a localized version of a resource name alias.

If, after determing that Apache is running with the right permissions for
the owned processes to connect to and use a network shared resource, then
it's probably an Apache UID conflict (is PHP in safe mode?).





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Rahul Sitaram Johari

On 5/24/07 11:04 AM, Jared Farrish [EMAIL PROTECTED] wrote:

 Well, I'll say you've dramatically upped the ante by having an Apache server
 on a windows box attempt to mount and read a file on a MacOS machine. Yipes!
 
 So let me get this straight:
 
  * Apache is on Windows Server 2003.
 
  * PHP is running on Apache.
 
  * A folder containing scripts/data/both is on a MacOSX machine.
 
  * A user from frontierland knocks on PHP's front host.com:80 door and says,
 Please...
 
  * PHP - Apache: Gimme gimme [resource P]
 
  * Apache says, Ok, let me get the data from location X.
 
  * Apache - location X: Pretty Please, gimme gimme.
 
  * location X - Apache: [barf]
 
  * Apache - PHP: No luck.
 
 

Jared, 

I think you got a little confused with a previous post of mine. Mac OS X is
Not in this scenario at all!!! So completely Eradicate it from this current
Scenario. 

This is a complete PHP/Apache on Windows 2003 Scenario. That's it!

So what it is supposed to be is:

* PHP5 / Apache2.2 on Windows Server 2003
* Folder on another Windows Machine on the Network contains some files
(mapped as network drive X:\)
* PHP trying to read file on X:\ from Apache on Windows 2003.

There's really nothing else to it.

 Can you, from the Windows 2003 machine, manually access the folder/file that
 you're asking PHP (through Apache) to access? Unless the service that Apache
 is running under has permissions to communicate with the share resource
 (location X), this will always fail.

Yes! Without any problems! I can easily navigate to the X: drive on that
Windows Machine, and do anything I want with files there. I have all
permissions. 



~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Rahul Sitaram Johari

You may have something here.
Problem is, I don¹t know how to mess with how  under what user Apache is
running ­ and no one else here does either so basically I have to figure
this one out! I would like to, as you suggested, try and ³get Apache to run
as a service under a user that can access the network resource².

I definitely agree about using non-mapped addresses and using the actual
Server Name addresses.


On 5/24/07 11:24 AM, Jared Farrish [EMAIL PROTECTED] wrote:
 
Are you running Apache under a different (non-privileged) account on the
Win2003 machine? If Apache is running as a service with a different username
(with no extended access to network resources), you will need to get Apache
to run as a service under a user that can access the network resource. And I
still think you should use non-mapped addresses instead of mapped addresses,
since a mapping is just a localized version of a resource name alias.

If, after determing that Apache is running with the right permissions for
the owned processes to connect to and use a network shared resource, then
it's probably an Apache UID conflict (is PHP in safe mode?).




Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Jared Farrish

On 5/24/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote:



You may have something here.
Problem is, I don't know how to mess with how  under what user Apache is
running – and no one else here does either so basically I have to figure
this one out! I would like to, as you suggested, try and get Apache to run
as a service under a user that can access the network resource.



Well, I have already described how to do this two posting ago (and the
advice from another user was to read the Apache documentation...):

1) Go to Win2003 desktop
2) Right-click on bottom, right part of desktop (right on top of the clock).
3) Select 'Task Manager', click Processes Tab, sort Image Name by clicking
tab.
4) Find 'apache.exe' or some variation of.
5) Look at the username associated with the process.

If this is 'System' or something type of special user (or a basic user
without network privileges extended to it), then you will need to modify
this by:

1) Locate the My Computer link on your desktop.
2) Right-click on top of the link, select Manage, choose 'Services and
Applications', and select Services.
3) Find the apache service, double click to open properties, click on the
'Log On' tab, and see what user it is setup to use.

If this is a system account, I would think you would need to change this to
a network account, preferably one for which the password will not expire...
If apache is not running as a service, then you will need to determine how
it is starting up, and modify that to run under a different process with
modified user permissions.

I definitely agree about using non-mapped addresses and using the actual

Server Name addresses.



For ease on the eyes, mappings are great, but they are not reliable for
programming purposes, IMHO.

For the advanced PHP gurus on the list, is it accurate to characterize PHP
as relying on Apache for file manipulation? Is it accurately described as:

Process Request-PHP-Apache-[File System Poof!]-Apache-PHP-Process

??? Just making sure I have this characterization correct.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 10:29 am, Rahul Sitaram Johari wrote:

 You may have something here.
 Problem is, I don¹t know how to mess with how  under what user Apache
 is
 running ­ and no one else here does either so basically I have to
 figure
 this one out! I would like to, as you suggested, try and ³get Apache
 to run
 as a service under a user that can access the network resource².

http://php.net/phpinfo

This should at least tell you what User PHP thinks it is running as.

You would change that in httpd.conf User directive on a Un*x box, and
that may also work on Windows.

There is also that whole Service GUI junk in Windows that may
overlay the httpd.conf settings, or not... That's just a question of
opening up interminible dialogs and clicking around until it works,
like all of Windows.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 10:43 am, Jared Farrish wrote:
 For the advanced PHP gurus on the list, is it accurate to characterize
 PHP
 as relying on Apache for file manipulation? Is it accurately described
 as:

 Process Request-PHP-Apache-[File System
 Poof!]-Apache-PHP-Process

This *might* be correct with PHP as an Apache Module, but I doubt it.

I think it's more like:

Whatever - PHP - stdio.h File System calls

Whatever will affect what user is running PHP and thus what
permissions they have, but that's about it.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php