Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to start an exe file without using command prompt? 1

Status
Not open for further replies.

Lulli

Programmer
Dec 11, 2005
14
SE
Hi

There is exe file called htpasswd.exe used by apache server and this file is located under \bin\ directory.
Using the following code I can open and communicate to htpasswd.exe from command prompt easily.

$cmd_add_new = "C:/Perl/eg/htpasswd -b logg " . "$user " . "$passwd";
system($cmd_add_new); #starts exe file

I have another perl script (which performs a POST method in an webb application). I added the above mentioned lines to the rest of that script in order to invoke htpasswd.exe "directly" from my script (skipping command prompt) but htpasswd.exe never executes. It only works when I run it from my command prompt.

Is there any help ?
Thanks //Swede
 
Please see the answers given in thread219-1163867 .

Posting the same question multiple times is unnecessary. If you need to clarify your original post, please do so in the same thread to ensure the thread is followed to conclusion.

- George
 
Hi

Is there any other posibility of solving this problem?

Thanks
 
Lulli, if you work with the guys who are willing to help, you might have some chance of following this to a succesful conclusion.

Completely blanking Rieekan's post is both arrogant, and ignorant.

In answer to your question yes it should be possible, but we need to know what we're dealing with.

What's the operating system? What's the webserver and version number?

As pointed out by Andy in the other thread, it looks like you're working on a *nix box, and the same command toolset for Windows doesn't work on *nix (well not very often at any rate).

If you can figure how to do it on the command line on the *nix box it should be straightforward to implement, chances are there's already a module for this on
 
Hi

Well guys, I am sorry if anyone felt ignored it was not my intention to put it that way. I'm quite new in both using perl and forums.
I really appreciate your efforts to help.

So, back to my problem. I'll try to explain the problem more detailed. Actually it is quite simple:

I work on a Windows machine (Windows XP pro) and have installed an Apache server (version 2.0.55) on my machine.
All the files that I'm going to mention here are located on my own computer and I use apache server as a localhost. I have a file called init.pl that gets invoked from my HTML-code like this:

<H4><FORM METHOD="POST" ACTION ="So init.pl is used in order to handle the data gathered by the POST method.

#in init.pl I use the following packages

#!C:\Perl\bin\perl.exe
use CGI qw:)standard);
use warnings;
.
.
.
# at the end of the file I have the following lines that won't work when they are included in init.pl file.

$cmd_add_new = "C:/Perl/eg/htpasswd -b logg " . "$userid " . "$passwd";
system($cmd_add_new);

#when I run this system function alone from command prompt it works and gives command to the htpasswd.exe file. This htpasswd.exe is normally located in Apache/Bin/ directory but I copied it to my perl directory in order to make my script testing easier.

Thanks again
 
As I stated in the other post, this looks to be a permissions problem. Your web server runs under a different ID than what you're logged into the computer with, mainly to ensure that web users cannot do anything that will corrupt your system. As a result, a web application (in your case, init.pl) doesn't seem to be able to run the htpassword application itself.

Try changing the permissions to allow the web server access to execute the file and see if you get your desired results.

- George
 
OK. Could you please explain more detailed how can I change permisions ? Is that something related to the settings on my apache server?

Thanks
 
This would be a Windows permission setting. I believe on XP (although, you may want to verify with that forum. I'm on Linux and rarely use Windoze) you want to right click the file, choose Properties... From there, choose Security, then make sure the Web User ID is allowed to Read and Execute the file needed.

Again, I would verify with the Windoze forum, but I believe that's still the correct way to do it.

- George
 
Well, I checked out my security settings and I didn't find anything strange. There is one thing I wonder... my init.pl file is located in apache/bin directory and that file works fine (gathers some data when a user on the client side types something in textboxes and pushes submit button for example).
When I add those code lines including system function to init.pl then it still works fine but the system function doesn't do anything. In my system function I try to invoke file htpasswd.exe that is actually located on my own C:drive (outside apache directory). Is that still related to this problem with Web User ID, or am I using wrong programming approach when invoking files located on different places on my PC?

Thanks
 
Yes, this looks to be a permissions problem.

Apache, which is not alone, sets up specific user ID account(s) that are used when people visit your site. These IDs are very restricted to what they can see and do on the server machine. Most of the restrictions only allow them to access web pages, and specific CGI applications that are available to the web site. Accessing a function that is not available to the web site requires that these IDs be added the ability to read and/or execute the application you're looking for.

You'll need to make sure that the application you want to run allows the web ID(s) created with Apache the ability to execute it.

- George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top