I have a .php script that produces different results when apache is launched as a service, as compared to when apache is simply started from the command line with httpd.exe.

I have checked things like the user that the apache service runs under, and have ensured that in both cases httpd.exe is owned by the same user in TaskManager.

It doesn't make any sense to me, but something must be different when running an executable as a service.

Any ideas?

Further information on what the PHP script is doing:

It is basically running an executable called CutyCapt.exe, which takes a website and renders a .png image from it. The difference I see is that CutyCapt anti-aliasing works when apache is run as a process, but CutyCapt anti-aliasing doesn't work when Apache runs as a service. So the two images look different.

  • My guess: Anti-aliasing is a graphical desktop feature, and since services don't create a desktop there's is no anti-aliasing. Without knowing what methods the program applies anti-aliasing, it's hard to say what's going on for sure, but I'd guess they're using GDI, and this will need to be addressed by the author of that utility. – Ƭᴇcʜιᴇ007 Apr 17 '14 at 17:40
  • If I check the "Allow to interact with desktop" option, in when configuring the service, it doesn't work. I would expect it to. Plus, I should add - this is not happening on other machines which have slightly different hardware (which are also Windows Embedded 7, but I did not configure them ); – patchwork Apr 17 '14 at 17:47

Your OS can be set to allocate and handle resources differently for running programs vs background tasks. To see a simple example of this on Windows 7, right click on my computer -> properties -> Advanced System Settings -> Performance -> Advanced

Right at the top you will notice a section called processor scheduling and you can see where they give you a choice as to which you prefer to have better access to resources.

If you are talking about something other than resource allocation you will need to provide more information about what you observe is different between the two methods and we can go from there.

  • A few other ideas on things to check would be to make sure that they are using the same config file, I would not think that was it, but its worth a try, run httpd.exe -n "PHPServiceName" this should start it with the config files that the service is using. I know you mentioned that the users are the same, but perhaps go into the PHP Service and change the user to an administrator account and see if that makes a difference. Is there any information in the logs? Is the logged information the same or difference when you perform the same task on each? – Chris Disbro Apr 17 '14 at 16:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.