CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
i have an emergency please help

 

First page Previous page 1 2 Next page Last page  View All


gerble1000
User

Aug 15, 2012, 6:36 AM

Post #1 of 35 (5182 views)
i have an emergency please help Can't Post

i had a virus recently and needed to reformat.
i have installed php and perl again but the php files no longer work in the cgi-bin directory. i only have 1 file i need to work,
this was the working command

Code
system('roundimage.php');


i could do with this perl script calling the file in the htdocs folder.
like so
system('C:/"Program Files (x86)"/"Apache Software Foundation"/Apache2.2/htdocs/customers/$domainname/roundimage.php');

but this does not work, i am sure its just the sintax is incorrect as i can get the php file running from the browser


Laurent_R
Veteran / Moderator

Aug 15, 2012, 7:06 AM

Post #2 of 35 (5175 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

Hmmm, I am almost never using Perl under Windows, so my advice may be clumsy or clunky, but if you write:


Code
system('C:/"Program Files (x86)"/"Apache Software Foundation"/Apache2.2/htdocs/customers/$domainname/roundimage.php');


the $domainname variable will not be interpreted correctly, because the command is created between single quotes (no interpolation of variables).

You have to construct your command differently. Perhaps changing double quotes to single quotes and single quotes to double quotes will be sufficient to solve the problem.

If this does not work, you can first construct the command into a variable and then run it.

Something like that:


Code
my $command = 'C:/"Program Files (x86)"/"Apache Software Foundation"/Apache2.2/htdocs/customers/'; 
$command = $command . $domainname . '/roundimage.php';
system ("$command");



gerble1000
User

Aug 15, 2012, 7:21 AM

Post #3 of 35 (5173 views)
Re: [Laurent_R] i have an emergency please help [In reply to] Can't Post

no joy
have you any other ideas.
it does not even like it when i leave out the variable like this

Code
system('C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/customers/mydomainname/roundimage.php');



(This post was edited by gerble1000 on Aug 15, 2012, 7:32 AM)


Laurent_R
Veteran / Moderator

Aug 15, 2012, 7:37 AM

Post #4 of 35 (5164 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

Well, maybe you can change directory first (chdir command), and then issue the command.


Code
system('roundimage.php');


If you print the current directory first, you will be probably be able to narrow down what the issue is, i.e. to find out if the problem is in the directory name or in the command line.


FishMonger
Veteran / Moderator

Aug 15, 2012, 7:42 AM

Post #5 of 35 (5163 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post


Code
my $command = 'C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/customers/mydomainname/roundimage.php'; 

system($command) == 0 or die "system call failed $?";



gerble1000
User

Aug 15, 2012, 7:51 AM

Post #6 of 35 (5161 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

still no joy,
no errors but does not run the php script :(


gerble1000
User

Aug 15, 2012, 7:56 AM

Post #7 of 35 (5160 views)
Re: [Laurent_R] i have an emergency please help [In reply to] Can't Post

not sure what you mean by print the current directory,
im guessing you mean display whats going on to the screen ,
not sure exactly


FishMonger
Veteran / Moderator

Aug 15, 2012, 8:00 AM

Post #8 of 35 (5157 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post


In Reply To
still no joy,
no errors but does not run the php script :(


I don't believe that.

If the php script did not get executed, then the die statement would have been executed which would have generated the error message and $? would have held -1 as its value.


gerble1000
User

Aug 15, 2012, 8:04 AM

Post #9 of 35 (5155 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

at the very end of my script i have
print"settings successfully changed";

and thats all i get,
but when i ran your modification it just hangs as if its uploading images thats 100gb large :(

just rechecked and it doesnt hang it actually gets to the end of the script but the perl script was not run


(This post was edited by gerble1000 on Aug 15, 2012, 8:06 AM)


gerble1000
User

Aug 15, 2012, 8:11 AM

Post #10 of 35 (5152 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

this is whats going on in the script before the system command


Code
 
my $upload_filehandle = $query->upload("uploadfile1");
open ( UPLOADFILE, ">$result1/file.jpg" ) or die "failed to open '$upload_dir/1.jpg' $!"; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE;
copy("$result1/file.jpg","$result1/thumb1.jpg");

system("PhotoResize700x500ICO.exe $result1/file.jpg");
system("PhotoResize140x100ICO.exe $result1/thumb1.jpg");

move("$result1/file.jpg","C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/customers/$domainname/file.jpg");



my $command = 'C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/customers/hiddendomainname/roundimage.php';

system($command) == 0 or die "system call failed $?";

and i gets the file.jpg to the correct location so that means that the path is correct in the move command


FishMonger
Veteran / Moderator

Aug 15, 2012, 8:13 AM

Post #11 of 35 (5151 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

You're not making any sense. You need to provide more details and your code. However, if your code anything like what you posted in your earlier question, then don't bother, because I'm not going to waste my time troubleshooting that junk.


gerble1000
User

Aug 15, 2012, 11:43 AM

Post #12 of 35 (5140 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

it does not even work with the basic script here



Code
#!/strawberry/perl/bin/perl -w 



use CGI::Carp qw( fatalsToBrowser );

print "Content-Type: text/html\n\n";








my $command = 'C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/customers/mydomainname/roundimage.php';

system($command) == 0 or die "system call failed $?";

print "<h1><center>SUCCESSFULLY CHANGED</center></h1>";



(This post was edited by gerble1000 on Aug 15, 2012, 11:44 AM)


FishMonger
Veteran / Moderator

Aug 15, 2012, 11:56 AM

Post #13 of 35 (5136 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

You need to be more specific.

What does "does not even work" mean?

What part doesn't work?

What results are you seeing in the browser?

I suspect that the php file is being executed, but does not do what you expect.

What are you expecting it to do and what is actually happening?


gerble1000
User

Aug 15, 2012, 12:19 PM

Post #14 of 35 (5133 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

when i got to the url of the .pl script and run it,
it just hangs like im connecting to a lagging server. just loading loading ect.
but if i play with the code a bit i can get it to display "successfully changed" but check to see if the php script has done its job and it has not.
and i can go to the php script url and it will run fine.
i am researching the issue and some people say it may be the program files (86) being to long so i tried getting the short versions like progra~2 and that did not do anything either.

i wish i could just get an error message or something

i have recently installed windows, could it be some security settings or something i am not setting


(This post was edited by gerble1000 on Aug 15, 2012, 12:20 PM)


FishMonger
Veteran / Moderator

Aug 15, 2012, 12:24 PM

Post #15 of 35 (5131 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

What happens when you execute the php script from the command line using the full path like you have in the perl script?


gerble1000
User

Aug 15, 2012, 12:30 PM

Post #16 of 35 (5129 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

when i go to the folder in cmd and open the script it just opens in notepad. im guessing i am not do this right.
whats the sintax to run from dos
i forgot to put php in front :)
it runs perfectly fine from cmd

these dont work either but the script does finish


Code
system("C:/Progra~2/Apache~1/Apache2.2/htdocs/custom~1/firstt~1/roundimage.php c:/php/php.exe"); 


system("C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\customers\hiddendomainname\roundimage.php c:\php\php.exe");



(This post was edited by gerble1000 on Aug 15, 2012, 12:47 PM)


FishMonger
Veteran / Moderator

Aug 15, 2012, 12:39 PM

Post #17 of 35 (5126 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

There's your problem

You need to setup a .php filetype association so that Windows knows to execute the script.

The other option is to adjust your system call so that it executes php and passes the script as an arg, which is what you did on the command line.


FishMonger
Veteran / Moderator

Aug 15, 2012, 12:46 PM

Post #18 of 35 (5122 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post


Code
my @command = '/path/to/php', 'C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/customers/mydomainname/roundimage.php';  

system(@command) == 0 or die "system call failed $?";



(This post was edited by FishMonger on Aug 15, 2012, 12:46 PM)


gerble1000
User

Aug 15, 2012, 12:46 PM

Post #19 of 35 (5120 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

ok i have done the file type association i think.
is this what you mean by the system call


Code
system("C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/customers/hiddendomainname/roundimage.php c:/php/php.exe");


as this did not work either but did finish the script

there is something strange i noticed,
it worked fine when i navigated to the directory in cmd and the typed "php roundimage.php"
but if i type " php C:/Progra~2/Apache~1/Apache2.2/htdocs/custom~1/firstt~1/roundimage.php"

then it does nothing with no error,
which is what the system call is doing,
any idea's


(This post was edited by gerble1000 on Aug 15, 2012, 12:58 PM)


gerble1000
User

Aug 15, 2012, 1:35 PM

Post #20 of 35 (5104 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

ok your right with the associate .php
i have noticed about 50 notepads open in task manager.
how do i associate with php as i right clicked and opened with c:\php\php.exe and it is still opening in notepad.
is there something i have to do to make it an executable php


FishMonger
Veteran / Moderator

Aug 15, 2012, 1:48 PM

Post #21 of 35 (5103 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

http://support.microsoft.com/kb/307859

http://www.winvistaclub.com/t19.html


gerble1000
User

Aug 15, 2012, 1:56 PM

Post #22 of 35 (5101 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

i have done all of those things and the file has the php logo on it but when i open the file it brings up a cmd screen for a split second and thats it, but i can still run it from cmd with the php command


FishMonger
Veteran / Moderator

Aug 15, 2012, 2:03 PM

Post #23 of 35 (5100 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

Can you execute it from the command line without putting php before the path to the script?

If so, how long does it take to execute and return you to the prompt?


gerble1000
User

Aug 15, 2012, 2:21 PM

Post #24 of 35 (5098 views)
Re: [FishMonger] i have an emergency please help [In reply to] Can't Post

just checked , no i cant.
i have a feeling that my php is corrupt as when i run the script like i did before it works but also shows a lot of corruped code that scrolls for nearly 1 minute


FishMonger
Veteran / Moderator

Aug 15, 2012, 2:25 PM

Post #25 of 35 (5097 views)
Re: [gerble1000] i have an emergency please help [In reply to] Can't Post

Your php installation may or may not be corrupt, but your .php file type association is not setup correctly.

First page Previous page 1 2 Next page Last page  View All
 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives