logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: difference bt Apache as a service and as a console
Author
elavarasan



Joined: 26 Sep 2011
Posts: 53

PostPosted: Wed 05 Oct '11 7:28    Post subject: difference bt Apache as a service and as a console Reply with quote

Can any one have answer?

when i try to start apache as a services in services.msc. then i'm face uploading a document issue.

Same if try to start apache as a console mode [ command line executive apache ]. then i'm able to upload a documents.

so why is that?

Thanks,
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Wed 05 Oct '11 10:01    Post subject: Reply with quote

With upload you mean a php script? If yes set the upload_tmp_dir in your php.ini to a folder where the windows service is allowed to write files. Maybe you also have to check if the service is allowed to move the file from the tmp directory to the document root.
That's why we recommend to place apache in a folder like C:\apache22 and not in your home directory.
Back to top
elavarasan



Joined: 26 Sep 2011
Posts: 53

PostPosted: Thu 06 Oct '11 3:16    Post subject: Reply with quote

Here is my problem snario :

On IP 192.x.x.1 our application is running and on IP 192.x.x.2 our uploading files will be there.

through our php script, we are uploading files by using apache as a console mode but not the as a service mode

We have installed Apache in C:\Apache2 and we have made it sharing permission between two system as well.

in my phpinfo.php file, upload_tmp_dir is no value.
when we try to upload by Console it is uploading a word document but not the in Services method.

I'm just wondering how apache console recongize but apache as services.

if i want to setup as a services then what are the steps do i need to do?

Thanks,
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Thu 06 Oct '11 10:32    Post subject: Reply with quote

elavarasan wrote:

I'm just wondering how apache console recongize but apache as services.


Windows knows which user runs the process. As console I guess apache runs via the admin user and the service it running with the service account.

elavarasan wrote:

if i want to setup as a services then what are the steps do i need to do?


Set the upload_tmp_dir in your php.ini to a folder and set the permission correct. In case of trial give all permissions to the "Everyone" group.

Implement error output to your upload script. In this case the input name is userfile. If something fail all error messages will be in $_FILES['userfile']['error']

See http://www.php.net/manual/en/features.file-upload.errors.php
e.g.
Code:

$uploaddir = $path_parts['dirname'] .'upload/'; //change to your path

if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .$_FILES['userfile']['name'])) {
      ?>
      Upload ok
      <?php

}
else
{
      ?>Upload failed
      <pre>
      <?php
      print_r($_FILES);
      ?>
      </pre>
      <?php
}      }
Back to top


Reply to topic   Topic: difference bt Apache as a service and as a console View previous topic :: View next topic
Post new topic   Forum Index -> Apache