PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Well,
All of my other php files work. Its on a server with php 4.4. Instead of executing the code, it asks for download!?!?!?
I dont understand it!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
save it in your server root folder and call the page my-php-info.php. Load it into your browser by going to http://yourserver/my-php-info.php and post back your results. If like you said, all the other PHP files are exectuing, this should work. If not, then your server set up is wonky.
Usually, when what is happening to you is happening, it has to do with Apache settings and the server not being told to execute PHP files throught the PHP engine.
EDIT: Quick update... I actually tried downloading the file it was offering, and it is a blank php file. Ive uploaded the file many times so I dont understand why this is happening... Could the file be getting corrupt by the FTP somehow everytime?
It may not matter, but are you sure you are uploading it in ASCII and not binary. Also, try downloading it using FTP and see what is actually on the server.
How big is the php page? Is it something you can post? Also, have you cleared your browser cache? And, if their is a live version, can you post the URL so we can try to hit the link and see if it is asking for a download from one of our computers?
Everah wrote:How big is the php page? Is it something you can post? Also, have you cleared your browser cache? And, if their is a live version, can you post the URL so we can try to hit the link and see if it is asking for a download from one of our computers?
I have tried it on several computers. It is uploaded. I have even tried it at other internet connections and computers.
BTW, I just noticed insted of going to index1.php the link i click on to get to it says index1.php?SESSID=dklasdgjklsdgadahdfhdfaha (except random stuff) Is that maybe the error?
No, that is a session url append mechanism that PHP adds to URL on the frst page load of a session'ed page. That should do nothing to the performance of the page or to the way it displays. Download the file by FTP to your computer. If it is not too big, past the exact name of the file and the content of the file in this thread so we can see what the server is seeing.
I can tell you just by scanning the page that there are going to be issues with this page. There are several incorrect syntax issues, the select query to get the users information has no where clause so it will return all users. The echoing of the form HTML is unneeded and the elsif check is unneded as well (if the var doesn't evaluate to true it will either be unset or false, so you don't really need to check for false using elseif).
Of course, none of this should cause the server to prompt you to save the file instead of parsing it. The only thing I can think of is an appended file name (using your editor to save the file as a .php file and having it saved as a .php.somethingelse file). Really, I am not sure what is causing the file to want to be downloaded. One last thing you can try is to upload a new .php file of some sort to the same directory and try to call it to see what happens.