Problem in nginx server not running php files suddenly - php

I have a dynamic website developed by native PHP on a server using NGINX which was functioning normally, but suddenly it broke down such that the PHP files no longer run and just download automatically to the client with the code whole source when he tries to excute that files. I don't know why it happened, and is it because of a hacking or an internal server problem. When I contact the web host, he says that a php file that is causing this problem, knowing that I haven't changed anything at last time.
Please clarify the cause of this problem if you have an idea !! Thank you in advance.

There is no idea yet ? I add that the last time, the host re-initialized the configuration of the VPS, and the website is now running well. It is clear that the problem was in the configuration! But I ask the same question, why did this failure happen? I want to know the reason: if the problem comes from PHP files or from the server itself !!

Related

Apache and NodeJs with proxy, issue to display the web page

this is my very first question here, so please be clement.
I have been programming for weeks a web site with both PHP and JAVASCRIPT, and I also use nodeJs with socket.io and express.
When I tested my localhost locally (on a linux Debian), I configured my app.js to work on the port 3000. Thus, there was no conflict between Apache (which is already working on port 80) and NodeJs, and everything worked well.
But since yesterday, I've attempted for the first time to host my website, and of course NodeJs didn't work anymore (I think it's absolutely normal, because only the port 80 is listened, isn't it ?), but the rest of the website still worked.
So, I did some research, and I've found a solution here which deals with proxy on Apache. Unfortunately, since I've done it, my browzer doesn't display my /index.php normally, instead of it, it tries to download index.php as a bin file.
(some precisions : my app.js is configured to work with /game.php, not /index.php, but if I try to access to /game.php it shows : "Cannot GET /game.php")
I'm a little lost, I'm still struggling to search some informations by myself, but I know that I'm lacking knowledges
PS : Before to do this handling of the apache2.conf file, I attempted to "turn" the port 3000 to 80 by modifying /etc/rc.local with iptables, but the same problem returned : the web browzer only wants to DL the /index.php....
Thanks for have read, and sorry for my bad English.
If you want more accurates details, ask me.
Your PHP config is messed up, you can tell any time you download instead of view them in your browser. If I had to guess I'd say that it has something to do with those virtual host blocks you added. Look up how to setup PHP with Apache, or ask your hosting provider for help. With the information you have provided, there is not much we can do for you as your question is not clear.

Failed to open Stream, no such file or directory

I recently started using the Laravel framework and i set up a little workspace for me to work in. I setup a Xubuntu client at home that runs a Apache server from which i program and host my Laravel instance from. Now recently I've run into a little bit of a problem. I was following a tutorial series and everything went fine, the next day however i run into this error http://puu.sh/nh5vQ/8ae11c52ab.png
Both from opening the /var/www/html/test/public directory in apache2 from my webbrowser or from running php artisan and actually hosting the laravel instance.
So the first thing that came to mind was permissions, but the permissions for the public folder are fine, It should be able to read or execute as any program. http://puu.sh/nh5Ho/06e061a056.png
Mostly other posts can reference to a bit of code where they specified the wrong filepath. What i find odd is that when i open my hosted instance of apache server in my webbrowser, where you can technically browse all the files in the hosted directory it is there in the list, but when i click it it pops up with that same error.
I checked if all the files that the server is trying to acces exist, and they do exist and i made no typo's.
I'm going to continue on looking and i shall post the solution as soon as i find one, though I'm hoping you guys have an idea since I've been looking for about 2 days to find a solution.
Thanks for your time
I Decided I'd have to start a new Laravel project to fix this without making a chaoticly configured project.

Tiny PHP Script runs fine on dev server, fails on hosted server

Im pretty new to php, Ive got a linux server running php 5.5.9 , and all I want it to do is take whatever is sent to it in an http post, and dump it to a file.
Currently the code I have is this
<?php
file_put_contents("outputfile.txt", file_get_contents('php://input'));
It works 100%, does exactly what I want when its on my own server.
When I upload it to my web server (HostGator) it gets a 500 error. The web server is running php 5.4, Im not sure if thats the issue.
Basically what Im trying to learn is why doesnt this work, and how do I fix it, its a pretty simple script.
John and Louis pointed me to the right answer, it was entirely the permissions on the folder the files were in. The folder was 777 for some reason, and switching it to 755 like the files were fixed it.
I had no idea that could even cause a 500 error

CI Can't find session variable when project is accessed from server

EDIT: Zen's comment below (which is already the accepted answer) did the trick. I've overwritten the php.ini on the server with the one on my workstation. I no longer have this problem.
On the server: I've tried to print $this->session->userdata('uid') in the controller right after I've set this session, and everything's good during that point but when I var_dump this uid in my login page it returns false. It doesn't exist. I've also already tried erasing cookies and everything in my browser several times. Also tried rebooting.
On my localhost: Everything is working fine.
Has anybody experienced this?
Background: After the system gets the login information entered by the user then validated if the user exists in the database, that's when this session variable is set in the model.
Has anybody experienced this?
My work station is running XAMPP 1.7.7 on windows 7 and the server is using XAMPP for linux on centOS, my browser is chrome. Anything else I should specify please let me know.
Try using exactly the same php.ini file from your local server on the remote CentOS machine - this will eliminate the possibility of an error in the php configuration (and turns out, that happened...)
This should always be high on your "what is causing this unexplained problem with PHP?" list.

My site is based on Symfony 1.4 and often crashes/goes down

It works properly, and after some minutes it just goes down... timeout, or no response. After some time it lives again. I don't do any special things, just testing. Has anybody met this situation?
are you running it locally? if so.. check your apache or IIS or whatever server you're using.
EDIT
For it to run local download
xampp
Check if you get the same problems

Categories