Website downloaded a php file
Just another reason to switch to an nginx-based solution. I think lighty has supported it for a long time too. Then they should move away from shared hosts. Sure they should move away, but many of them stick with shared hosting because of the higher costs for managed server hosting.
Hi, i used your code to create a download. I would like to protect also my folder from url access, if i use as chmod value, the page will not return the download file, but it will stay blank the fopen fail.. Which value should i use for access files from the code? Or protect your directory via. Does the download work with regular permissions? I deny the access to the folder. The script gave me an empty file.
Do you use the windows versions? The file is opened in corrupted format. Do you checked the file size for the downloaded file? Tip: Open the file in your text editor, most of the time you can see an error message. Solve the the reported problem.
Otherwise check also your PHP error log. Thanks for the reply. But PDF, image file, txt file will download correctly for same code. This means that when your browser makes a request to read a PHP file, the web server does not serve up the file to you - instead, it executes the file using one of several possible PHP.
Pan Php File Manager. It manages uploaded images and document files. In short, it manages the uploaded file, and allows you to do whatever you want with the file, especially if it is an image, and as many times as you want. It is the ideal class to quickly integrate file upload in your site. In the case that nginx is running and apache is not, just run sudo service nginx stop; sudo service apache2 start and your server will now serve php files as expected.
I know that there are 1. So I figured that I would add the solution to my problem here. If I commented these two lines out in my.
I have no idea what they do or how they got there, - but it is in every one of my. I have VirtualMin installed on an Ubuntu I upgraded to PHP version 7. I got the error that his post talks about: For every site on my VPS, it simply downloaded the index. I had a similar problem to the OP when upgrading php5 from an older version, to 5. I'm running a LAMP setup on a machine on my local network, which I use to preview changes to websites before I upload those changes to the actual live server.
So I maintain a perfect local mirror of the actual site. After the upgrade, files which run and display perfectly on the actual site would not display, or would only display html on the local machine.
PHP was not parsed. The phpinfo command worked, so I knew php was otherwise working. The log generated no errors. Viewing the page source showed me the actual php code. This worked. I got this kind of problem. This is how I solve it.
Different type of PHP versions installed to my computer. Then I remove some PHP packages from my previous list, using apt-get purge. For people who have found this post from Google almost 6 years in the future and beyond! Another possible cause of this problem could be that you are trying to run the script in a "user directory" from the the UserDir module.
Running PHP scripts in user directories is disabled by default. You must comment or delete the tag block at the bottom that reads. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. Apache is downloading php files instead of displaying them Ask Question. Asked 8 years, 3 months ago. Active 1 year ago. Viewed k times. OS and server information: CentOS 6. Thank you. EDIT: I have these lines in the php. Improve this question. Anthony Gainor. Anthony Gainor Anthony Gainor 1, 2 2 gold badges 9 9 silver badges 9 9 bronze badges.
Well, how did you install it? Which SAPI? Your php module is not running. I edited the questions. The modules do exits and they are being loaded apparently — Anthony Gainor. Did you restart apache after installation? Show 6 more comments.
Active Oldest Votes. Improve this answer. Mihkel Mihkel 6 6 silver badges 2 2 bronze badges. Could you add some info where to put these lines? For people looking for where to put these lines. In my case , on Apache This works, adding d part to x-http-php like on your post works!