PHP Files Not Running

Barjawi
Barjawi used Ask the Experts™
on
The Problem:
When I run my website, the first page index.php loads successfully. I enter the username and password, and it login successfully, but then instead of running the second file (fcheck.php) it actually asks me to download it and save it.

I am not sure what I did wrong, as it used to run successfully beforehand... I did not do any changes to the php code. My changes were only with the services installed on the machine and the configuration.

The Story:
First, I am new to the linux world. I am trying to build up a Fedora 12 server that has Apache, PHP, MySql, phpMyAdmin, Subversion, Samba, and Flash Media Development Server 3.5.

Using the internet, I was able to install and configure all of these items on a virtual machine using Sun's Virtual Box application.

I have an already built and working website. I copied it to this machine and tried running it. Before I install FMS 3.5, it used to run successfully. After I installed it, it started asking me to download the php file instead of running it. Of course, it might not have to do anything with FMS 3.5, but it might be me playing with the configurations trying to make FMS work with Apache.

Tests:
1- My server runs php files. It already runs Index.php, and I tried making a dummy file with <?PHP phpinfo(); ?> and it ran successfully.
2- I disabled SELinux and Firewall. So I don't think they are part of the problem.
3- I tried running the (fcheck.php) directly from the webbrowser by calling: mydomain.jo/fcheck.php. It worked in terms that it did not ask me to download it, but of course it did not run successfully because it requires some session variables that are missing.
4- The problem should not be in the script that calls fcheck.php as this website is already running and functioning on another server. In addition, I did not make any changes to the code AND it used to work on my server at some point in the past.

Any hints and help is highly appreciated.
Thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
hi,
provide the rights to the page and folder.

Commented:
what is the inside address of core switch?

192.168.3.10 ?
3- I tried running the (fcheck.php) directly from the webbrowser by calling: mydomain.jo/fcheck.php. It worked in terms that it did not ask me to download it, but of course it did not run successfully because it requires some session variables that are missing.


Do you mean if you login, the fcheck.php is not working ( ask you to download), otherwise it's working?

I suggest you replace the fcheck.php page with test content  <?PHP phpinfo(); ?> .  If you login and it still work, something might be wrong in the fcheck.php page.


You can put back the original fcheck.php, login and download it and compare the content , see if it's same as the original fcheck.php.   something a php script can output a different http header, and trigger the browser to download ( like when you download a attach file from forum, the url is a php, but the browser download it as a zip file )





Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Thanks for your replies.

insoftservice:
I already executed the command "chmod -R 777 [foldername]" on my web folder. So the rights should be fine. But here is an (ll) command on the file and the folder:

drwxrwxrwx. 72 root root 4096 2010-01-28 03:16 www
-rwxrwxrwx. 1 root root 2973 2010-01-27 23:59 fcheck.php

lfckwan:
I am not sure what you mean by core switch. I am running the server on a virtual machine using Sun's Virtual Box. I am using a Host Only adapter with the ip address: 192.168.56.106

jackiechen858:
Yes, this is what happens with me: login -> browser asks to download fcheck.php.
The other option I tried was to navigate in the address bar to the address (mydomain.jo/fcheck.php) and this one did not ask me to download the page.. Instead, it tried to run fcheck but failed because of missing session variables.

Creating a <?PHP phpinfo(); ?> in place of fcheck.php resulted in the same thing (asking me to download the page). Using option 2 (calling fcheck.php through the address bar) worked successfully and showed the phpinfo page.

I downloaded the fcheck page when it prompted me. The result (using notepad and wordpad) was empty file. However, using Notepad++ there was a  "NUL" in the file. I wonder why the file is empty?
hi,

please provide the link

Author

Commented:
Sorry I cannot provide a link. The virtual machine is connected on the Host Only Network, and does not have access to the outer world. I don't know how to make it so anyway.

If there is something you want to test by having the link, please let me know and I can provide you the results.

Thanks a lot.
hi,

Creating a <?PHP phpinfo(); ?> in place of fcheck.php resulted in the same thing (asking me to download the page). Using option 2 (calling fcheck.php through the address bar) worked successfully and showed the phpinfo page.


did ur vmware is supporting ur php.
i think php and apache is not install properly

does ur index.php contains html tags.

hi,
normally index.php with html tags are open without any issue. but rest page it gives issue.

on cmd prompt just type

service apache restart

service mysql restart

and provide complete o/p if possible.

mns did it gave ok or it gave fail in some cases

1. login page -> POST? -> http://address1/fcheck.php
2. direct access http://address2/fcheck.php

This is very strange. first,are the two way to access fcheck.php page use same address? or is 1 using https instead of http?

If 1 is using https, then the apache server is not configured properly.

if 1 and 2 is using same url to access fcheck.php, the only difference I can see is 1 has some varible ( session, post, get ) set, then propbably the apache server is not working properly and you should just reinstall it.

You can do a test, put content in fcheck.php:

<?
foreach ($_GET as $key => $value) {
print "GET key:$key,value:$value<br>";
}

foreach ($_POST as $key => $value) {
print "POST key:$key,value:$value<br>";
}

foreach ($_SESSION as $key => $value) {
print "SESSION key:$key,value:$value<br>";
}
?>

call the page by fcheck.php?aaa=bbb&ccc=ddd, to confirm it handle GET properly.

write another page test1.html :
<form id=form method="POST" action="fcheck.php">
<input type="text" id="memberid" name="memberid" value="">
<input type=submit value="submit" >
</form>

test if POST working properly.

write anoter page test2.php :
<?
session_start();
$_SESSION["user"]="AAAAAA";
header("location:fcheck.php");
?>





?>

















 


Author

Commented:
I think I found out the solution.

Earlier when I installed FMS 3.5, and then I restarted Apache, it gave me [FAIL] when trying to listen on port 80 because another program was listening on that port. After investigating, I found out that FMS was listening on that port. Searching Adobe's website, I found several solutions to this problem (which can be found on this link: http://help.adobe.com/en_US/FlashMediaServer/3.5_AdminGuide/WSE2A5A7B9-E118-496f-92F9-E295038DB7DB.html). I chose the (Configure HTTP proxying) solution which states that Apache listens on a dummy port, and then FMS diverts all httpd connections to that port while FMS listens on port 80. Putting Apache back to listen on port 80 solved my problem.

The thing that I don't understand is that since Adobe allowed their FMS to forward the requests to Apache server, what did I do wrong that made the php file not work.??

thanks all for your help and effort. This is my first question in Experts-exchange, so I am not really sure how to give the points, but I will select on Accept Multiple Solutions.

Thanks,

Author

Commented:
Non of the solutions gave accurate or complete solution, but they served as hints that helped me find the final solution.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial