I have so far tried
Editing php.ini to allow_url_open = on;
I have tried placing error_reporting(0) at 0. I have tried ini_set('display_errors', 0) too. I still get a warning in my page. I also tried @fopen and file_get_contents… This is the code:
<?php
/**
* Image Detect - Do we have images on the CDN v2
**/
$cdnurl="http://www.****-cdn.com/";
$pid=$product_info['sku']; // database variable decalred earlier in page
$oldfile="".$cdnurl."catwalk/movies/".$pid.".flv";
$newfile="".$cdnurl."assets/".$pid."/v/".$pid.".swf";
$combi=0; // out variable
if(@fopen($oldfile,"r")===TRUE){
$combi=1;
} else {
if(@fopen($newfile,"r")===TRUE){
$combi=2;
} else {
$combi=3;
}
}
?>
Warning : fopen(http://www.*-cdn.com/catwalk/movies/564_white.flv):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in
/var/www/www.sitedev.com/web/template.inc.phpWarning :
file_get_contents(http://www.*-cdn.com/catwalk/movies/564_white.flv):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in
/var/www/www.sitedev.com/web/template.inc.php
These are the warnings… I have searched extensively and tried using ===FALSE and ==FALSE but I cannot hide the warning. I am aware the file does not exist but I just want it to skip, this code works on other servers and other cloud nginx servers that are the same setup.
phpinfo(); shows
allow_url_fopen On On
allow_url_include Off Off
error_reporting no value no value
Appreciate any help, my first question so go easy!
** UPDATED ****
I hope this is OK. The site says I can answer my own question.
The problem was script related. I use OpenCart Ecommerce platform and in that software there is something called – set_error_handler – this completely overrides everything else.
So in future since Opencart is bloated with these queries, visit /opencart root/index.php and find “set_error_handler(‘error_handler’);” and replace and comment it out.
// Error Handler
//set_error_handler(‘error_handler’);
“So in future since Opencart is bloated with these queries, visit /opencart root/index.php and find “set_error_handler(‘error_handler’);” and replace and comment it out.”
It would be wiser to find the function
error_handlerwhich has been set as the error handler and alter the behaviour for the error type being hit in this case. Commenting out the line mentioned will cause your application to revert to PHP’s standard error handling which may not be desired.