Getting this error after I hit this website 20 times IP blocking or any other thing I don't know why.
Warning:
file_get_contents(http://www.azlyrics.com/a.html?time=1454075435):
failed to open stream: HTTP request failed! in
C:\xampp\htdocs\travel\simple_html_dom.php on line 77 Fatal error:
Call to a member function find() on boolean in
C:\xampp\htdocs\travel\searchplaylist.php on line 61
I've Code files
If you want to I'll upload
both file codes in this link
https://drive.google.com/folderview?id=0BzMyD6UnaIfWZDZFWXN3akFwd2s&usp=sharing
Just add # infront of file_get_contents. (#file_get_contents).
This will not raise any errors if the request fails due to any reason.
My issue was that the server i was getting content from might be down sometimes and during those times i got an error. # will not raise them.
But remember to use this only in cases where you understand why it might fail and you just want to handle those cases. Don't use it somewhere where you might have made mistakes and want to hide them.
Related
I checked the server log recently, there are so many error types.
1 . AH00126: Invalid URI in request GET /../../terms HTTP/1.1 .
This kind of error is the most common one, our website is on Wordpress. This page is on www.MYSITENAME.com/terms. I check most of the pages, and checked the links, all of them did not cause this invalid Request.
But if I use postman, type the URL directly, like: www.MYSITENAME.com/../terms, this would cause the error and also it would be catched and logged.
Any idea about this error? I search it on google, someone said it is the problem from the .htaccess file, but I dont really understand it.
2. PHP Warning: mysqli_query(): (00000/0): in /var/www/www.MYSITENAME.com/public_html/wp-includes/wp-db.php on line 2007
I have no idea about this one.
3. PHP Fatal error: Out of memory (allocated 20971520) (tried to allocate 77824 bytes)
4. PHP Warning: Error while sending QUERY packet. PID=22936 in /var/www/www.MYSITENAME.com/public_html/wp-includes/wp-db.php on line 2007
5. PHP Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /var/www/www.MYSITENAME.com/public_html/wp-content/plugins/wp-cerber/common.php on line 1968
6. PHP Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /var/www/www.MYSITENAME.com/public_html/wp-content/plugins/wp-cerber/common.php on line 2017
Any idea about Any error?
Thanks.
For the first error:[ AH00126: Invalid URI in request GET /../../terms HTTP/1.1 .], I found out where was going wrong. On my site, sitting on wordpress and also editting from wordpress, we used the relative URL before. Now we fix it to the absolute one.
I have searched for some relevant questions, someone said this kind of problem is caused by crawler program, but others said .htaccess leads the problem. But I do recommend just go through your own code about the URL parts first
I have a strange php issue.
I have a custom front-end post submission form for WordPress. It most of the time but the other times it seemingly at random doesn't work.
My PHP error log spits out the following:
PHP Warning: copy(): Filename cannot be empty in /home/y567889/public_html/wp-content/themes/colormag/inc/front_deck.php on line 1071
PHP Warning: file_get_contents(https://ygoprodeck.com/pics/Trinity World Chalice-deck-14461.png): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/y567889/public_html/wp-content/themes/colormag/inc/front_deck.php on line 1025
PHP Warning: unlink(/home/y567889/public_html/pics/Trinity World Chalice-deck-14461.png): No such file or directory in /home/y567889/public_html/wp-content/themes/colormag/inc/front_deck.php on line 172
So in theory, a user could submit 10 posts. Sometimes 2 of those posts would generate with errors (missing featured image etc etc) with the above error in the php log.
What I have tried:
Changed copy() to move_uploaded_file() with no joy.
Changed permissions on the "pics" folder to 775.
It occurs to one of my users in particular. It happens him with every post he attempts to upload. Generating a new WP account fixes this for him (although it still fails occasionally as per usual).
Because the error starts at line 1017 I'll show what the code is for that:
function moveYdktoDeck($ydkId,$postid){
$ydkUrl = wp_get_attachment_url( $ydkId );
$newfile = $_SERVER['DOCUMENT_ROOT'].'/UploadedDecks/3/'.$postid.'.ydk';
copy($ydkUrl, $newfile)
}
Function wp_get_attachment_url can return false. Check that before you use it in copy function.
I have a listener script to which i want to upload a file using CURL(not the command line version) however, it is not getting recognised as $_FILES['htmlfile']. other post vars are also required on the server. How can i solve such an error?
After some changes to my script, i get the 417 - Expectation Failed message. Any ideas?
Add this in your curl request. It will prevent 417 error.
curl_setopt($curl,CURLOPT_HTTPHEADER,array("Expect: "));
Other possible solutions:
cURL Simple File Upload - 417 Expectation Failed
It's important to know that you are "overwriting" error. It's something like fix but usually is okey. 417 is typical error when you have request between http1.0 and http1.1.
Hello i have a stupid question i search in stackflow there was lots of answeserd but i couldnt find solution for my problem i want to call a file in php receiving error actually the code is correct but i am receiving a problem error which is:
Warning: require_once(1) [function.require-once]: failed to open stream:
No such file or directory in C:\xampp\htdocs\Upload images\upload.php on line 2
Fatal error: require_once() [function.require]: Failed opening required '1'(include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\Upload
images\upload.php on line 2
I am using dreamweaver. i deleted the path with directory and recreated with different name but not solved still prob exist. also i did google there also i didn't find solution ??????? any one please my head is exploding....??????????????????????????????
A quick test on my system reveals that require_once("file") or error_function(); fails with that exact message; require_once("file"); does not.
This is possibly because require_once is a statement rather than a function, and might have different parsing rules, causing your statement to actually be require_once('db.php' or mysql_error());. The PHP or operator with those arguments will return TRUE without calling mysql_error, causing the statement to be require_once(1) (1 == TRUE) - which would generate those messages. This is just my speculation.
tl;dr
Try removing the or mysql_error() from your code. require_once will generate a fatal error anyway. (Warning: Works On My Machine™.)
Try write complete path in require_once(path)
I'm in the middle of some work and suddenly I get this.
Warning: require(/opt/lampp/htdocs/ERP/laravel/÷5 ication)
[function.require]: failed to open stream: No such file or directory
in /opt/lampp/htdocs/ERP/public/index.php on line 34
Fatal error: require() [function.require]: Failed opening required
'/opt/lampp/htdocs/ERP/laravel/÷5 ication'
(include_path='.:/opt/lampp/lib/php') in
/opt/lampp/htdocs/ERP/public/index.php on line 34
This error is shown on some requests that have no relation, so there is not a problem with them. This problem started showing a few hours ago
I have checked the files mentioned on the message and they are OK, based on the download I just made to make sure.
If I keep refreshing the page the file name changes. If I insist, it will end up loading my page. This process is costing me a lot of time, I'm trying to make some tests and sometimes this message shows up.
Well...you said that it happens in same pages that make requests, take a good look on your requests and try looking for something wrong.
A good tip is to use the Profile on your framework configuration. You will have a bottom bar with details about the queries executed and logs created.
I think that will help you find the problem.