PHP 404 Error Message - php

I have begun learning PHP using an eBook. The following strange results are happening: Per the book I have created two simple PHP files. They are named phpinfo.php and hello.php. Both files show in the user root directory. Both files show when I use the ls command in my mac terminal.
When I try to run them in my browser only the first one runs. The second results in a 404 error, File Not Found. How is this possible? Could an internal file mistake cause this?
Thanks

Thank you all. It was suggested that it would be easier to delete everything including the app and start over. So I did and then downloaded MAMP. That worked.

Related

404 Not Found error after commit changes on PHP application Openshift

I'm having problems with my PHP applications, I have created and deleted several of them because everytime I commit changes my application crushes and it shows the "404 Not Found" error.
I'm sure there are no coding errors for two reasons:
1. The same code was working days ago, it was after wednesday that I'm getting this message.
2. The same code works on my development environment.
This happens after I commit any change, even for the first time, and after that there is no turning back, so I have to delete it and create it again.
Can anyone help me?
Thanks anyone for the help.
This is just a shot in the dark, but do you put your php files into a subdirectory called php? If so, openshift automatically sets that directory to be your document root. It would certainly result in a 404 if you navigated to the /index.html when index.html is actually one folder up.
You can read about the way that openshift automatically sets the document root here: https://blog.openshift.com/openshift-online-march-2014-release-blog/
I had this problem today because I was not commiting all of the files.
You should use:
git add -A
This will add all of the files in the directory to your next commit, without this command, only the files that already existed and were changed (apparently) would be commited.
After that, use:
git commit -a -m 'commit message'
Now your files should be uploaded to the server.
Also, use git status to see the files staged for commit and the ones that are not.

Php files show blank page

i have php 5.3.1 installed on apache2 in ubuntu 12.04 server .
my site was working fine untill last week when i found some of the files were missing and website was not showing.I uploaded site again on server and now when i browse any php pages it shows a blank page and also when i try to see the source code in browser for the blank page it dosnt show any source code.the html files are all showing up.
i dont think it is the server or appache2 probelm as i have other site with php on the same server working fine.
i checked with php files they are alrite.checked with the htacces.txt and that is same as the other working site on the same server.
can anyone here help what the problem could be.
thanks
Rida
Check error logs in /var/log/apache2/error.log
I got the same problem while installing a third party LAMP application and the cause was missing php5-mysql package.
Hope this helps others.
Sometime this white screen may occur because of the php page that is included by include() and include_once() functions, which may have some error or any syntax error that are not reported by the php server.
This happens because the included php page are executed first before the actual php page and if any error that is present in the included file occurs that suppresses the error catching then further php codes are not executed and a blank page is displayed.
First try to find that which dependent file has the problem by // toggling each include() or includ_once() one at a time.
After the culprit dependent file is found try to check it for the errors.
In my case this happened when I un-installed Zend using its uninstall.sh, I then needed to edit the Apache config /etc/apache2/sites-enabled/000-default.conf to remove any references to Zend Server. I did restart Apache, but restarting the whole machine helped to revive PHP bindings.
In my case I find out that the include_once() function which I put on the top of the page was the problem . I red the answer by Gaurav Kispotta , that is where I got the tip . so if you have the same problem first comment that out , maybe even the entire code depending on that include .
You should never ever use require_once or include_once.
It will burst your server memory.
Just go with include or require.
php is a server side language so viewing source from browser will not yield any result if the whole codes are surrounded by php tags. Download the files from the server using an ftp client and try to open in an editor to see if there are still codes in it.

Opening Yii Application causes download of index.php

I recently downloaded Yii in my linux-ubuntu system. After extracting the files to /var/www/vishnu/, I went for creating the first webapp.
What I have done is executing /var/www/vishnu/yii/framework/yiic webapp anyname in my command line. It succesfully created the application under /home/ti/anyname
But whenever I am trying to access it, It downloads the index.php file instead of opening the webapp home page! Why does this happen? I tried, the following Urls..
localhost/vishnu/anyname/ - Returns Not Found
home/ti/anyname/index.php- Downloads the file
home/ti/anyname/index-test.php- Downloads the file
I can see the files in file:///home/ti/anyname/ But can't open anything. When ever I click on it, it is being downloaded! Please share your solutions if you have any...
Thank you very much. I got it from this blog.
I changed the command such that, the webapp will point to my localhost itslef.
ie php /var/www/vishnu/yii/framework/yiic.php webapp /var/www/vishnu/yii/anyname/
Now its working... :)

Symfony project is not work on local pc

I have this trouble: i copy symfony project files on my pc, after that change paths and db settings, and it still not working, even dont tell about errors! Maybe there is some specific actions for setting up symhony on another server?
Almost the same problem How to configure symfony project in local server? but when i try execute "php symfony" it prints "no such file or directory"
There are no any php errors at all.
Using Fedora 15 OS, and apache. php work in command line, symfony is not working. I tried to find out what is happening - inside Controller.class some error, when it use processObjects method, it take 11 objects, and after first of them (header.object.php) it stops.
The white screen generally means symfony can't write to cache and/or log dir, check on apache error logs to see details.
if 'php symfony' on command line throws no such file or directory could mean php is not in your system path.
Please add more information to get answers
myabe, as said below is a permission problem of the caché and log files. Check if they are writable. Good Luck!

Apache doesn't execute my copied PHP files, but testing.php works

I've just installed LAMP on my Ubuntu 9.10 machine, and everything works fine except when I copy my PHP files from another computer.
The LAMP guides I've followed also made me create a phpinfo() test file, which works, but when I try to type in e.g. index.php absolutely nothing happens - just a blank page in FireFox. :(
The files are in the exact same directory.
I'm thinking it's probably something with permissions and so on, but since I'm new to both PHP and Ubuntu, I'm kind of lost. It's like I can't create a PHP file with my file browser, but only by using the terminal - like when I created the testing.php from the LAMP guide.
Whaddayaknow... I made an error, tried to:
echo "Hello" world
which, even though I'm a PHP noob, I clearly know is wrong.
I think I'll have to figure out how to enable some sort of error reporting, a blank page is clearly not good enough.
You mean you have a index.php (copied from another computer) and a test.php (edited by hand, with a call to phpinfo()) in the same apache directory, the second works from your browser and the first doesnt ?
That can be a permission issue, or some compilation error in your php.
About permissions, for files should be readable from the apache server (more precisely, form the user that runs the apache server). You can type chmod a+r index.php.
YOu can also check your apache error logs (location dependent on installation). In any case it's vital to know where the error logs are if your are developing a web site.

Categories