running file_get_contents function in PHP. But if *PUBLIC authority to the
IFS file is *NONE I get a permission denied warning and the function
returns FALSE.

How to know which user profile a PHP script is running as?

Is there a way a PHP script can elevate its authority? Maybe, use the
QSYSETP API to change the user profile of the PHP server job ?

set_error_handler("warning_handler", E_WARNING);
$text = file_get_contents( $fromIfsPath ) ;
restore_error_handler();

// -------------------- warning_handler ---------------------
function warning_handler($errno, $errstr)
{
global $fromIfsPath ;

if ( strpos($errstr, 'Permission denied') != FALSE )
{
echo "Permission denied.\n" ;
echo 'file:' . $fromIfsPath . "\n" ;
}
else
{
error_log( 'warning. errno:' . $errno . ' text:' . $errstr ) ;
echo 'warning. errno:' . $errno . ' text:' . $errstr ;
}
}

thanks,

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.