It is currently Thu Mar 28, 2024 12:03 pm


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Executing PHP from Perl CGI
PostPosted: Mon Apr 04, 2022 11:54 am 
Newbie
Newbie

Joined: Wed Mar 23, 2022 8:07 am
Posts: 7
Hi
First, as a background I am trying to encrypt data we have on the server when a new entity is made. This is on a legacy system which originated as a Perl CGI system, and has a separate portion which is PHP. The Perl part creates the groups, the PHP was later implemented to encrypt it.

I am trying to execute the PHP encryption script from a Perl CGI file. I have tried using:

exec("/path/to/file arg1 arg2")
system("/path/to/file arg1 arg2")
backtick operator /path/to/file arg1 arg2
open ("/path/to/file arg1 arg2 |)

I have also tried pointing directly to /bin/php and passing the file as an argument with each case. The only things I have had happen so far are:

Printing the output of exec/system... produces the Perl file (not even the php file) as text, which I haven't seen any mention of this happening anywhere else, but all I've seen is Perl, not CGI and Perl together.
No data. If I output $! from Perl I get an illegal seek error when using system, but the others leave it blank. All of them return 0 as if the exec/system/... has run, but nothing server side has changed.
From what I have read online I think that CGI may be running in some form of a "protected" mode which disables the exec/system/open/backtick commands on certain files, but am not certain that is the issue. As far as I can tell though, there is no indication of permission being restricted. If anyone has any insights that is much appreciated. If you need anymore information, let me know.


Top
 Profile  
 
 Post subject: Re: Executing PHP from Perl CGI
PostPosted: Wed Apr 06, 2022 4:48 am 
Getting Started
Getting Started

Joined: Wed May 26, 2021 3:14 pm
Posts: 52
Hello,

Please note that this is a forum for our hosting and in general we do not offer web developing services or have the knowledge to answer most of the questions on this matter. You might find more information in web developers' forums instead. Thank you for your understanding.

Best Regards,
Damon Felix
ModeratorsTeam
Freehostia.com

_________________
Damon Felix
ModeratorsTeam
Freehostia.com


Top
 Profile  
 
 Post subject: Re: Executing PHP from Perl CGI
PostPosted: Mon Apr 25, 2022 6:35 am 
Newbie
Newbie

Joined: Wed Mar 23, 2022 8:07 am
Posts: 7
PHP didn't lose too much; 6 was supposed to be the next release after 5.2; we got 5.3 -> 5.6 out of the remains of what 6 was trying to be. Considering what those releases brought to the language, I'm glad we didn't lose the time to get them. It was at most 4 years (5.3 dropped in 2009; 6's development started in 2005), but because the pivot was good, I feel like PHP only really dropped about 2 years.

PHP7's improvement made up for it for sure!


Top
 Profile  
 
 Post subject: Re: Executing PHP from Perl CGI
PostPosted: Wed May 18, 2022 5:31 am 
Newbie
Newbie

Joined: Thu Apr 14, 2022 12:53 pm
Posts: 8
Show us actual, mimimal and complete test programs along with their output so we can see what you are doing.

system shares its filehandles with the parent program, so if the external program sends something to STDOUT, that's where it's going. If that's before you send your CGI headers, then things will get messed up.

backticks will capture standard output, but not standard error. Stuff might still go to an error log.

exec turns your program into some other program. That is, your Perl program does some setup and then becomes the thing that you exec, then never comes back (unless things fail).

Some things to help with debugging:

Make a small CGI program that simply calls another program you know that should work, such as date or something similar. Verify that you can do that echatspin omegle much.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ]  Moderators: Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011