I used file_get_content() to read from the uploaded image temp file and store in database.
Everything is work fine except this warning. It show every page of my site. And there is no such page "footer.php". Is it the server problem or I need to change that function.
Warning:
file_get_contents(http://admanager.nethosting.com/getads/www.mogoke.5gbfree.com/):
failed to open stream: Connection timed out in
/usr/share/php/footer.php on line 11
The problem is another invocation of file_get_contents, which downloads advertisements from a remote server, but that download fails due to network problems or a firewall.
This looks very much like your code or server had a security vulnerability and someone uploaded code that includes ad banners on your website (but the money for the clicks of course goes to the crooks instead of you). Removing the malware (i.e. the added advertisement lines, probably heavily obfuscated) should suffice. See this security.stackexchange.com question for more details.
Related
I have a codeigniter app that grabes and then pushes data from one database to another. This process takes a large amount of time, and I want to update my user of what files are being queried and pushed. I decided that the best solution was to write the progress messages to a txt file and have my front-end page (index.php) use ajax to send a request for the message by fetching it. I use a session to create a unique session token and use that to create the name of the txt file. This way, no two users will get each other's messages.
I managed to get this working on localhost, but the problem now is how I get it to work on my live server with the proper permissions. I uploaded the code to my server and received this error when trying to run:
Severity: Warning Message:
file_put_contents(application/tmp/d9jf9d9f9jdd9jfd09u09dj0sjf9s0.txt): failed to open stream:
Permission denied
On localhost, I chmodded the application/tmp directory, so this wasn't a problem, but I can't seem to do this on the AWS live server, at least, not permanently (also a bad practice, I hear). Is there an alternative solution to this problem?
i am trying to copy a image, it is hosted here, this is just an example:
http://111.74.239.161:8898/uploads/allimg/130821/2-130R1100341.jpg
I want to copy the image, but i keep getting connection refused. What could be the root of this error ?
What strikes me as odd is that its using port 8898 ?
If you can view the image in a browser that is on the same machine as your program, then it might be that the server won't send the picture unless you look like a user rather than a program. In that case, modifying the browser identification string might fix your problem.
If you cannot view the image from a browser running on the program's PC, you will need to look elsewhere for the source of your problem.
Well, this is a problem I have never seen before.
I am trying to stream an FTP file using PHP's fopen() and feof() in order to copy it from one server to my own. This works fine when using normal http:// URLs. However, when using the ftp:// protocol, I'm receiving the following error:
fopen(ftp://.../streaming/planted2.mp4) [0function.fopen0]: failed to open stream: FTP server reports 550 /streaming/planted2.mp4: not a plain file.
Bear in mind that I have confirmed the URL is correct.
If I pop it into my browser's search bar, it always loads correctly.
Following this error, any attempt to use feof() or fread() on the wrapper results in an error complaining that the respective function expects a resource, but that instead a boolean is being provided. This would not be the case if fopen() was not failing.
As the files are quite large (several gigabytes at times) streaming is mandatory. Also, due to the configuration of the server, I need a way to loop through each chunk in order to buffer some output. If I don't, the server holds up. It's a weird configuration on Rackspace's behalf. That's why I'm using feof().
So, without further ado, my question is this: What does the 550 error mean, and what is a "plain file"? If it is a problem with the configuration of the server I am attempting to download from, what are my options, given my limitations?
EDIT
I have determined this is a server issue. However, the problem is still unresolved.
I contacted my boss and our server administrator, and the server guy told me to test this out on a different Windows-based server instead of the Linux-based one I was playing with. My script works with the Windows server, so I have confirmed my script is not in error.
Unfortunately, my boss still wants me to figure out the problem, and find out why it's not working on the Linux box. I have absolutely no idea why, and don't know where to look. Any hints would be greatly appreciated!
I've just come across this issue when trying to get a file from a sco unix server.
Server File Location: /home/user/data/myfile.csv
I can put the below into any browser and it gets the file.
ftp://user:password#host/data/myfile.csv
However if I run the below, I get the same error as you
$f = fopen("ftp://user:password#host/data/myfile.csv", "r");
However, if I put the full path into fopen - it works fine.
$f = fopen("ftp://user:password#host/home/user/data/myfile.csv", "r");
I'm not sure if this will fix it for you, but works for me.
Have been trying to solve an issue with out client updater for a couple days now. It compares the file structure on our SVN to client ftps and updates/removes where necessary. I've come to the conclusion that some files don't get updated because of a
if ($stream = fopen($path))
that all of a sudden (after many successful attempts) fails. I'm not including too much code because I doubt it would help. It all quite abstract and full of defines.
What happens is I upload a couple scripts to the server, run them and then delete them again. These scripts get called with fopen().
But for some reason after a bunch of fopen() calls to the uploaded script (before the delete, I have checked this and made sure the scripts successfully get uploaded aswell)
it all of a sudden throws this error
fopen(http://www.mysite.com/back_it_up.php) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
Anyone have any idea what might be interfering with my fopen?
Ive tried clearstatcache() and checked the rights of all the files (0755) and done quite a bit of research on this problem already.
I am using the official Microsoft example and this example as the basis for my code to upload a file from Silverlight to a PHP script.
I am calling **HttpWebRequest.BeginGetRequestStream()**, writing the file over a file stream, and then calling **HttpWebRequest.BeginGetResponse()** to get the response. When I call HttpWebResponse.EndGetResponse() I get the following exception every single time:
{System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at FileUpload.FileUploadProcess.GetReponseCallback(IAsyncResult AsyncResult)}
I have both clientaccesspolicy.xml and crossdomain.xml files in the base directory that allow access. I ran Fiddler and have seen it download the clientaccesspolicy.xml file so it is hitting it correctly.
The PHP file is running on Apache2 and just does a fread on php://input to read the data as the examples show. It is not receiving any data which leads me to believe that the SecurityException is forcing it to abort the write.
Has anybody seen this issue before and can point me in the right direction of a solution?
Have you checked to make sure the webserver/php application has write access to the directory you plan on storing the uploaded file to?
This could be causing it to abort prematurely.