Page 5 of 5

Posted: Thu Dec 07, 2006 11:32 pm
by neel_basu
If The Host Doesn't Run php In Safe Mode Can I Then Use shell_exec or exec()

Posted: Thu Dec 07, 2006 11:51 pm
by volka
There are other ways to disable the exec functions.
Try

Code: Select all

$fns = array('shell_exec', 'exec');
foreach($fns as $f) {
	echo $f, function_exists($f) ? ' exists':' does not exist', "<br />\n";
}
echo 'disabled functions: ', ini_get('disable_functions'), "<br />\n";
echo 'disabled classes: ', ini_get('disable_classes'), "<br />\n";

Posted: Fri Dec 08, 2006 12:26 am
by neel_basu
No no
I Dont Want To Disable It

I Wanna Know If I Am Hosted In A Shared Hosted Linux Server Where Safe Mode Is Turned Off and I am Alowed To Use program Execution Functions In php Then -->


OK Wrote In Linux I Have To Define The Full Path To The out File
OK On 4th Page wrote: I tested it and it can run but the PHP code should like that:

Code: Select all

$output = shell_exec('/full/path/to/executable/pass_arg.out arg1 arg2'); 
echo $output;

In Shared Hosting What Would Be The Full Path ?? Is It like http://www.mysitename.com/somedir/paaa_arg.out ??
or Some Thing Else And In Shared Hosting How Can I Know The Actual Full Path Where I am Hosted Are There Any Function To Get It ??

If Its then How To Use That Function

If Its Not Possible Are there Another program execution Functions in php By which
I can Execute pass_arg.out file Without Specifing The Full Path Of That File


Are There Any Other functions In php That Doesn't requir The Full Path To The Binary out File Are There Any function That Can work With The short Path

Posted: Fri Dec 08, 2006 1:05 am
by volka
neel_basu wrote:No no
I Dont Want To Disable It
:?: I know
Ok, let's try again:
If The Host Doesn't Run php In Safe Mode Can I Then Use shell_exec or exec()
MaYbE. mAyBe NoT. nOt RuNnInG iN sAfE mOdE dOeS nOt GuArAnTeE eXeC() oR sHeLl_ExEc() ArE aVaIlAbLe
TrY tHe ScRiPt. It WiLl TeLl YoU wEtHeR tHe FuNcTiOnS aRe AvAiLaBlE oR nOt
neel_basu wrote:In Shared Hosting What Would Be The Full Path ?? Is It like http://www.mysitename.com/somedir/paaa_arg.out ??
or Some Thing Else And In Shared Hosting How Can I Know The Actual Full Path Where I am Hosted Are There Any Function To Get It ??
You haven't tried what ok suggested, have you?
neel_basu wrote:If Its Not Possible Are there Another program execution Functions in php By which
I can Execute pass_arg.out file Without Specifing The Full Path Of That File
You can use a relative path, see http://en.wikipedia.org/wiki/Path_%28computing%29

Posted: Fri Dec 08, 2006 1:21 am
by neel_basu
Then Can I Mak Sure About It That

Code: Select all

$output = shell_exec('/full/path/to/executable/pass_arg.out arg1 arg2');
would do The Same Job As

Code: Select all

$output = shell_exec('pass_arg.out arg1 arg2');
If Both of Them Are in The same Directory

Posted: Fri Dec 08, 2006 4:17 am
by dibyendrah
Even though shared host are not running in safe mode, they might sometime don't allow to use certain functions which might be harmful for the shared server.


Suppose if php.ini contains the following options :

Code: Select all

disable_functions = exec, shell_exec
You'll not be able to use these functions.

Posted: Fri Dec 08, 2006 4:58 am
by ok
I suggest you to convert the C program to a PHP program. If you don't know how to do it, post here the code of the C program and we will help you.

Posted: Fri Dec 08, 2006 6:50 am
by neel_basu
Actually I am Trying To Build A Module For Encryption

And If Its A Php File Someone May Decrypt it Creating The Reverse Code Of That
php file

Thats Why I Am Trying To Build It as A Binary File

Posted: Sat Dec 09, 2006 1:12 am
by volka
There's still no need for an "external" program for that. Chances are you'd rather increase the threat level. And as mentioned: It's unlikely your method beats those of standard encryption modules e.g. provided by mcrypt. You might come up with a fabulous new way of encrypting data one day but as a beginner ....
Really, there's no point to it and you'll learn as much or even more from using a given crypto lib as from trying to build some encoderish thingeling ;)