404 Not Found error after commit changes on PHP application Openshift - php

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.

Related

PHP 404 Error Message

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.

Git won't pick up changes to certain files

Have a very odd and annoying issue with Git/GitHub.
In a certain branch, any file that has the path as /views/admin/index.php, /views/teacher/index.php, /views/parents/index.php, /views/student/index.php won't detect any changes to the files no matter what. Deleting the file, removing all the code, or just making a small edit isn't picked up at all.
We are using Codeigniter v2.2.0 as the framework, if that is of any use.
This is happening through any folder with a file structure like that.
Have tried multiple different software including the GitHub native app and Sourcetree.
There is another branch we have that works fine.
Tried cloning the branch with the issue but it still has the problems on the new branch.
Any ideas that could help would be great :)
Whenever you have a file which seems to be ignore, you quickly can check that with git check-ignore:
git check-ignore -v -- /path/to/yourFile
That will help list the exact .gitignore referencing that file.
Massive facepalm moment.
I had index.php in the .gitignore, I needed to have /index.php to ignore only the index.php in the main directory.
If your using SourceTree as you mentioned, change the File Status combo from the Working Copy view to "Show Ignored".
It doesn't display ignored or untracked in "Show All".

Replacing PHP file - file doesn't work anymore

I have a weird problem I cannot seem to solve (as a php noob).
I am working on simple php site (no sql involved). Everything was working perfectly till the moment I decided to copy over the files and edit them on another computer. All worked fine on the other computer as well. Then I took the files and copied them to the first computer again. Here came the problem: if I try to open ANY file copied from the second computer, it doesn't show anything, just a blank page. Even if the file was not edited at all on the second computer.
For example my index.php:
1. Copied from comp 1 to comp 2, no edits done
2. Copied from comp 2 to comp 1
3. Opened in the browser -> blank page
What's going on here and how to solve it? Is it some cache that apache is keeping? How to clear it? Both computers with OSX, however the second one was running MAMP, while the first had php/apache/sql set up.
Your permissions need to be set up correctly. Do the following:
Change the owner of the group to your user
chmod 0755 all the directories
chmod 0644 all the files
Then you are good to go!
You need to make sure that your permissions are set up correctly.
Apache Permissions
The blank page is displaying because Apache is encountering a PHP error somewhere, but is not set to display PHP errors.
Check out what is going on in your Apache error log and work from there. You could also look in the Developer Tools of a browser like Chrome, or use Firebug, to see what response your browser is getting from the server (most likely a HTTP 500 error).
I wouldn't recommend blindly changing ownership on files and directories until you know what is going on.

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