I'm running a project on a server which runs IIS 7.5
There's a strange error that I have never seen. The project is written with Codeigniter. I'm converting videos with ffmpeg.exe and writing the results in separate text files for each video. And in the client side it reads the text file for progress.
But the server throws a 404 error for existing txt file. It keeps throwing error until I restart the server. After restarting the server, it can be able to show the text file.
Everything else works perfect. Please help me.
EDIT:
.txt files are reachable after amount of time. But it's not certain how much time should pass.
I found a solution. This isn't a solution to the source of the problem but works for me.
I think, IIS was throwing the 404 error because the file is being processed and locked by ffmpeg. I was getting the file contents by file_get_contents() via HTTP address and it returns an empty string or error message. So I decided to use the physical address of the file and to use read_file() function with output buffering.
It's now working without any error.
Related
I wrote JS to upload really large videos in chunks and PHP script to assemble the pieces on the server. The file process works except that I can't play the file unless I "Restart All Services" from the PHP taskbar. After that the file plays fine. If I try to rename the file in Windows Explorer I get the follow error:
The action cannot be completed because the file is open in httpd.exe
I suspect it may have something to do with never calling move_uploaded_File(), but that calling that procedure won't work on the assembled file.
Found it myself. Nothing to do with move_uploaded_File not being called. There was a syntax error that stopped the script before the file was closed. Since the server had been set to not display errors it wasn't apparent that an error occurred before the file was closed.
The temporary files are closed(explicitly) after being appended to large file being assembled. It seems that this accomplishes part what move_uploaded_file does, that is, disposing of the temporary file after using it. The script ending probably does that too.
I am currently working on a simple php website
The problem is , the images in my whole web site(happens in all php files) randomly corrupt and show the error
Resource interpreted as Image but transferred with MIME type text/html, however, if I try to refresh the page several times. The image can be loaded again and the error is gone.
I have checked all img path and the image is exist. Also, I checked there is no img src="" in my file. Is it due to server setting? I check .htaccess file and it is blank. How to fix the problem ? Thanks
One possible reason for this could be an intermittent server error, which serves an error page instead of the image resource.
Apache's access.log will tell you which response code the images were sent with (200 means "ok"). error.log will tell you the exact error message if you find an error.
This could also be the intermittent hick-up of a company or ISP proxy server.
I went to edit this PHP file - it's supposed to generate those captcha security images on contact forms - the images werent working, so I was going to see if there was a broken path or something i could fix simply.
But when I opened the file it looked like this:
http://mydomainsample.com/explosion/screenshots/Screen%20Shot%202012-05-17%20at%209.34.14%20AM.png
complete gibberish.
Is it possible this happened somehow while downloading the file from the server? I did not have ftp access to the site originally - we got control of the domain and transferred it from one host to another.
I used site sucker to backup the site before transferring, but it downloads php files as html files. you end up with filename.php.html.
in the past this has never turned the php into incomprehensible gibberish, so i dont understand why it did now.
The problem is, you cannot use programs like "site sucker" to get PHP files. This is because when you get a PHP file from a URL, the file is executed, and you're getting the output of the script. That's why you get .php.html.
It doesn't "turn the php into incomprehensible gibberish", the server runs the script and you're getting the output. Most of the time the output is HTML, which you can open as text. In this case, the script's output is a PNG file, thus why you see "gibberish". Rename the file to .png, then you'll see the image.
You need to get FTP access in order to get the PHP source.
That's a PNG image, not PHP source code.
The file actually looks like a PNG image, maybe you just downloaded output the PHP script has generated?
I have a weird unexplainable phenomenon going on.
I downloaded some source code from a website, a basic PHP script. It came with an SQL to reference numbers as part of the script.
I uploaded the file called post.php and SQL file to my server and ran it - but - instead of executing the code in the PHP file, it loads the content of the webpage of the author of the source code. and stays on my server URL.
The code in the file has nothing to do with the author's site, or graphics or links or redirects or anything.
EVEN IF I delete the entire contents of the post.php file, run the empty file and it STILL LOADS CONTENT from the author's website, where I downloaded it from.
Refreshed browser, restarted, reloaded, you name it. How is this physically possible?
-----UPDATE
In addition when I try renaming PHP files on my server, they become permanently broken "oops broken link" error.
It would be very helpful if you could post some more specific details about what the script was, etc. But, here is my guess. Firstly, make sure that your web server is not doing any caching. If the problem persists, try getting rid of the post.php file itself. Then, I would check to see if the PHP script has created any HTML/PHP files on its own. If all else fails, try going into the code that you downloaded and see what its doing.
I try to upload a file through PHP's ftp_put function, like so:
ftp_put($this->conn_id, $rempath, $locpath, $mode);
However I get the error "Cannot STOR." Nothing more. The FTP-connection is OK since I can download files using the same settings and ftp_get(). The script should be OK as well since it works fine on my local setup but not on my public server.
What can I try to make it work? I Googled but found nothing of worth.
You should first check to make sure that you are able to upload using a regular FTP client. I see you say "there's no problem withmy FTP-client" but in the initial request you said you are able to download files successfully and failed to mention a successful upload. I believe you will find that uploading with a client will fail too because that message is the output of FTP and not PHP. Whether or not it is a permissions issue remains to be seen, but it is unlikely a PHP issue. Do a little more research on FTP error 550.
Sounds like a permissions error. Are you sure you have permissions to upload the file to the location you are trying to put it at? If you try to do the upload manually via FileZilla or something does it work?
You should check to be sure you have write permissions on the directory into which you are trying to put the file(s).
Cannot STOR is a permission issue. Doublecheck the permissions for the FTP user.