I'm using google drive WP media WordPress plugin for my WordPress site
but this plugin keep give this error on my nginx server, can someone can help me fix this code
[error] 4437#4437: *175114 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined offset: 1 in /var/www/myhost/htdocs/wp-content/uploads/gdwpm_images/index.php on line 4
PHP message: PHP Notice: Undefined offset: 1 in /var/www/myhost/htdocs/wp-content/uploads/gdwpm_images/index.php on line 4
PHP message: PHP Notice: Undefined offset: 1 in /var/www/myhost/htdocs/wp-content/uploads/gdwpm_images/index.php on line 4" while reading response header from upstream, client: 122.167.98.6, server: myhost, request: "GET /wp-content/uploads/gdwpm_images/0B73eY08zeFxawYUhGOTA.jpg HTTP/1.1", upstream: "fastcgi://127.0.0.1:9070", host: "myhost", referrer: "http://...
and here's the gdwpm_image/index.php code
<?php
if (isset($_GET['imgid'])){
$gdwpm_ekst_gbr = explode('.', $_GET['imgid']);
if($gdwpm_ekst_gbr[1] == 'png' || $gdwpm_ekst_gbr[1] == 'gif' || $gdwpm_ekst_gbr[1] == 'bmp'){
header("Content-Type: image/" . $gdwpm_ekst_gbr[1]);
}else{
header("Content-Type: image/jpg");
}
$gdurl = "https://docs.google.com/uc?id=" . $gdwpm_ekst_gbr[0] . "&export=view";
#readfile($gdurl);
}
?>
I tried to fix the code, but no changes.
Somebody can help to fix it?
Thanks!
After the following line...
$gdwpm_ekst_gbr = explode('.', $_GET['imgid']);
Check if $gdwpm_ekst_gbr has any array items before trying to access the [1] element.
The error message you posted occurs if the array item, at the index you are trying to access, is not present.
Related
I've searched for a solution everywhere but I couldn't find an answer. Some days I got this error without change or do anything:
And I can't access my website in the entire day but suddenly starts working again without any change, and some days later the same problem. What can I do?
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator at
webmaster#magic.kiwitextil.com to inform them of the time this error
occurred, and the actions you performed just before this error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
My site is: www.magic.cr
I can access to the backend always! (magic.cr/administrator)
I've checked my server logs and I got this lines repeating constantly:
[23-Aug-2016 16:44:53 UTC] PHP Deprecated: Non-static method
JApplication::redirect() should not be called statically, assuming
$this from incompatible context in
/home/kiwitex/public_html/magic.cr/templates/braink/error.php on line
9
[23-Aug-2016 16:44:53 UTC] PHP Notice: Undefined property:
JDocumentError::$_messageQueue in
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
on line 376
[23-Aug-2016 16:44:53 UTC] PHP Notice: Undefined property:
JDocumentError::$client in
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
on line 394
[23-Aug-2016 16:44:53 UTC] PHP Notice: Trying to get
property of non-object in
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
on line 394
[23-Aug-2016 16:44:53 UTC] PHP Fatal error: Call to
undefined method JDocumentError::close() in
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
on line 409
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
Lines 376 to 409
if (count($this->_messageQueue))
{
$session = JFactory::getSession();
$session->set('application.queue', $this->_messageQueue);
}
// If the headers have been sent, then we cannot send an additional location header
// so we will output a javascript redirect statement.
if (headers_sent())
{
echo "<script>document.location.href='" . str_replace("'", "'", $url) . "';</script>\n";
}
else
{
$document = JFactory::getDocument();
jimport('phputf8.utils.ascii');
if (($this->client->engine == JApplicationWebClient::TRIDENT) && !utf8_is_ascii($url))
{
// MSIE type browser and/or server cause issues when url contains utf8 character,so use a javascript redirect method
echo '<html><head><meta http-equiv="content-type" content="text/html; charset=' . $document->getCharset() . '" />'
. '<script>document.location.href=\'' . str_replace("'", "'", $url) . '\';</script></head></html>';
}
else
{
// All other browsers, use the more efficient HTTP header method
header($moved ? 'HTTP/1.1 301 Moved Permanently' : 'HTTP/1.1 303 See other');
header('Location: ' . $url);
header('Content-Type: text/html; charset=' . $document->getCharset());
}
}
$this->close();
/home/kiwitex/public_html/magic.cr/templates/braink/error.php
Lines 8 to 10
case "404":
JApplication::redirect("index.php/404-error"); // replace the redirect URL with your own
break;
Please help I cannot access my site in the last 36 hours!!!
I'm trying to get a YouTube channel's video views and it works perfect on localhost but I'm getting this error on my public web server:
Warning: file_get_contents(https://www.googleapis.com/youtube/v3/channels?part=statistics&id={MY YOUTUBE USER ID}&fields=items%2Fstatistics&key={MY API KEY}): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /var/www/*****.net/public_html/dashboard/inc/youtube-api.php on line 9 Notice: Trying to get property of non-object in /var/www/*****.net/public_html/dashboard/inc/youtube-api.php on line 10 Notice: Trying to get property of non-object in /var/www/*****.net/public_html/dashboard/inc/youtube-api.php on line 10 Notice: Trying to get property of non-object in /var/www/*****./public_html/dashboard/inc/youtube-api.php on line 10
Here's the code I'm using:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
function getYouTubeStats($stat)
{
$channel = json_decode(file_get_contents("https://www.googleapis.com/youtube/v3/channels?part=statistics&id={my youtube user id}&fields=items%2Fstatistics&key={MY API KEY}"));
return $channel->items[0]->statistics->videoCount;
}
echo getYouTubeStats($stat = null);
?>
I am using soap call request to below URL using PHP SoapClient.
https://stagingxml.tamarindtours.in/Version1.0/BaseDetails.svc?wsdl
I have used follwing code.
$HeaderSecurity = array("UsernameToken"=>array("Username"=>"xxx",
"Password"=>"xxx",
)
);
$client = new SoapClient('https://stagingxml.tamarindtours.in/Version1.0/BaseDetails.svc?wsdl',array('trace' => 1));
$header[] = new SoapHeader("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security",$HeaderSecurity);
$client->__setSoapHeaders($header);
//$client->__setLocation("https://YourTargetLocation/"); if you have wsdl file you don't need to use this line
$REsponse = $client->GetCountries();
I am getting following error.
Fatal error: Uncaught SoapFault exception: [a:InvalidSecurity] An
error occurred when verifying security for the message. in
/opt/lampp/htdocs/wssoap.php:148 Stack trace: #0
/opt/lampp/htdocs/wssoap.php(148): SoapClient->__call('GetCountries',
Array) #1 /opt/lampp/htdocs/wssoap.php(148):
SoapClient->GetCountries() #2 {main} thrown in
/opt/lampp/htdocs/wssoap.php on line 148
Can you please help me out? Thanks.
Server may have an invalid SSL certificate.
If this error is not important for you, try to ignore SSL certificate check as explained here : https://stackoverflow.com/a/8447706/911718 (see comments too about allow_self_signed option)
Edit : Same error as you & error solved at https://stackoverflow.com/a/16794759/911718
My script try to open every site from a file read line by line but when try to parse a site which doesn't exist the script stop and give me these error:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\simple_html_dom.php on line 76
Warning: file_get_contents(http://www.thissitedoesntexist.com): failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\simple_html_dom.php on line 76
Fatal error: Call to a member function find() on a non-object in C:\xampp\htdocs\test2.php on line 11
How can I fix it ? How can I make it to run even if a site doesn't exist... to read a new line from my file(which means to read another site and then to read it) Also the scrip stop when receive errors like 404, 403, etc.
I would do this, to check for the error codes ---
foreach ($sites as $site) {
$ch = curl_init('http://'.$site);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute
curl_exec($ch);
// Check if any error occurred
$info = curl_getinfo($ch);
if($info['http_code'] != 200) {
continue;
}
//rest of loop, here --
}
You could even do something different depending on the error code you get with a case-switch --
According to the documentation, file_get_contents() returns FALSE on failure.
So, check what it returns to be sure that the site exists before trying to parse the returned content. If it doesn't exist, iterate to the next line in the file and keep continue the process:
if($file = file_get_contents("http://www.thissitedoesntexist.com")) {
// Parse file here
// Then continue reading the file by
// starting at the next line.
continue;
}
Reference:
file_get_contents()
I'm getting an error from this Twitter script that is causing the rest of the page to not load. Not sure why suddenly this is happening, where it was functioning properly for quite some time.
The script looks like this, and it pulls the users current status:
<?php
$response = new SimpleXMLElement('http://twitter.com/users/show/tuscaroratackle.xml',NULL,TRUE);
echo $response->status->text.'';
?>
Here's another post that I was trying to figure out the answer to another bug which pointed me to this Twitter error.
You can see it here in the footer, or a screengrab of the output: http://cl.ly/33IZ.
The relevant error (which is displayed in the footer of the page you linked to) is:
Warning: SimpleXMLElement::__construct(http://twitter.com/users/show/tuscaroratackle.xml) [simplexmlelement.--construct]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home5/tuscaror/public_html/footer.php on line 47
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: I/O warning : failed to load external entity "http://twitter.com/users/show/tuscaroratackle.xml" in /home5/tuscaror/public_html/footer.php on line 47
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home5/tuscaror/public_html/footer.php:47 Stack trace: #0 /home5/tuscaror/public_html/footer.php(47): SimpleXMLElement->__construct('http://twitter....', 0, true) #1 /home5/tuscaror/public_html/index.php(119): include('/home5/tuscaror...') #2 {main} thrown in /home5/tuscaror/public_html/footer.php on line 47
The first warning tells you what happened: "HTTP request failed! HTTP/1.1 400 Bad Request".
So, for some reason, your server is failing when making the HTTP request to twitter to retrieve the document "http://twitter.com/users/show/tuscaroratackle.xml". The return code is 400 Bad Request.
I just tried that same request from my web browser, and it worked fine, so either twitter was temporarily "out to lunch" (which does happen from time to time), or there is something unique about your server's network configuration. My first guess would be that somewhere up-stream from your server, someone has installed an HTTP proxy which is (for some unknown reason) blocking your request.
Here's what twitter has to say about it:
400 Bad Request: The request was invalid. An accompanying error message
will explain why. This is the status code will be returned during rate limiting.
Here is twitter's page on Rate Limiting. I suspect that this is your culprit. If you think otherwise, then you might try retrieving the document as a string and examining it before you try to parse it, so you can see what the message is.
This is quick and dirty, but it'll get the message so you can see what's going on:
$str = file_get_contents('http://twitter.com/users/show/tuscaroratackle.xml');
echo $str;
that may fail due to the 400 response code. if so, you'll need to use php curl to get the un-parsed response body.
good luck!