TL;DR
I get a 404 (Not Found) error on calling an API method (api/auth/authenticated~GET). I only get this on my live-server, not on local and not on any other methods.
The Problem
I use Codeigniter with a Rest-Server library. I have a simple method api/auth/authenticated(GET) that returns true if the user is logged in and false if not. On the live-server this method gives me a 404 (Not Found) error. Other calls to the same api class work, for example api/auth/login(POST) works and api/auth/logout(GET) works as well.
so how is this possible?
I have tried to delete the .htaccess file, but that didn't work. It can't be a typo since it works locally. Maybe some setting in Apache? But then why do the other methods work just fine?
I would be grateful for any ideas and hints.
my app
CodeIgniter 3.0.3
CodeIgniter Rest Server
AngularJs 1.5 with ngResource for client-side
my server env
digital ocean droplet
Ubuntu 14.04
PHP 5.6.15
Apache 2.4.7
The worst problems are always the most stupid ones ...
There should be a list on my desk.
1. Check for typos (very important but was not the problem here)
Now if we are working on Windows or OSX and everything works fine and then some parts just don't work on Linux this one is very important:
2. Check filenames for case-sensitivity problems (also check the GIT config)
The Problem was still a bit harder to find. I use Git to push my live-deploybranch to my remote repository, which is then picked up by Deploybot and uploaded to my server. Git doesn't care about case sensitivity on default and files will stay like they were first added forever. Thanks to this post i could just type one command to change it.
git config core.ignorecase false
Related
I am in the process of setting up a local version of the Laravel Skote template (https://themeforest.net/item/skote-html-laravel-admin-dashboard-template/25548061) on a WAMP64 server on my Windows machine (following these instructions https://themesbrand.com/skote/docs/setup-laravel.html), and upon install I am I am presented with an HTTP error:
"The GET method is not supported for this route. Supported methods: HEAD."
I have found other questions related to this, but in each case the proposed answers relate to the type of request set in the Controller and code itself, and not addressing the server setup in any way.
I tested the exact install on a live test server (DigitalOcean Debian 10) and the install works absolutely fine. For this reason I believe it is a setting within WAMP itself to enable GET/POST/PUT/DELETE http methods, and not something that should need changing in any route settings in the Laravel files.
Can anyone please help on how to enable this on WAMP. Any help would be appreciated.
I don't think it's connected with your WAMP because the message about not supported GET method is from Laravel (so Apache allowed that request and then Laravel catched it [Symfony component in fact]).
Run php artisan route:list and check if the route that you want to access works for GET method.
Until yesterday my Phalcon PHP application was running perfectly on PROD and today is working only on DEV and LOCAL environments... and I don't have a clue what is going on there! The codebase is exactly the same on all environments, the configs and the routes are correct as well.
For example, if I want to get to a custom defined route, like "/my-custom-route", it always gives me the error message "MyCustomRouteController handler class cannot be loaded". But the rest routes are working fine, like "/contacts" which comes from ContactsController.
As an additional information, "/my-custom-route" has been implemented through ToolsController and gearAction().
The problem appears only on PROD! On DEV and LOCAL there are no such issues which is super strange... The LIVE server is Debian with Apache. DEV server is the same (Debian/Apache), and LOCAL has Ubuntu/Apache installed. All versions are the latest ones - Phalcon Framework (3.4.5), Apache (2.4.41), PHP7 (7.0.33), MariaDB (10.1.43).
Does anyone have an idea where might be the issue?
My first guess would be a case sensitive issue. But since you're running Debian on dev as well don't think this is the issue.
Not sure what changes are done but maybe you're looking at a file being cached by opcache?
Problem solved! Turns out that it was a configuration issue. I use values from an INI file where env, site_url, api_url are defined and the site_url was set without 'www.' which caused the custom URLs to be unavailable.
I have a strange issue with my Laravel 4.2 app.
I have two servers with DirectAdmin installed on both of them.
I use .env.testing.php on one, and .env.production.php on the second one.
First (testing) works fine, but on the second one the .env.production.php isnt handled at all.
I made a simple test and added echo 'test'; in the file on both servers - and on production nothing happend and as I expected on testing 'test' word was displayed on the screen.
I'll be glad for any tips, sollutions - anything than might help with this.
And, yes the server is recognised as production one, yes I tried to use putenv and getenv to see if it is doing its job - both works fine.
And no I have no idea why it's not working :/
Note: You may create a file for each environment supported by your application. For example, the development environment will load the .env.development.php file if it exists. However, the production environment always uses the .env.php file.
I've been working on a project on my local machine (running OS X with Cake server) using CakePHP 3 Beta. Sometimes I copy this project to a remove test server (running Ubuntu with Apache).
Last time I copied all the files to the remote server, Beta 2 was the newest version, and the site was running just fine on both machines.
When Beta 3 came out, I updated my local project and continued working on it on the local machine without running into any issues.
Today I copied the whole project to the test server, just as it is on my machine (adjusting database configurations, of course), but something weird is happening this time:
When I access URLs like http://www.example.com/controller/action I get a Missing Controller error, as can be seen in the screenshot below:
I've been following the conventions as seen on the documentation, so my controller is the class UsersController inside the file UsersController.php
But if I access http://www.example.com/Users/action, for example, it just works.
Keep in mind that the exact same files work on my local machine using lowercase URLs, so it isn't just some typo or misplaced file.
This happens for all my controllers.
Should I now follow the naming conventions the error page suggests me and user lower case first letters on all my controllers?
Is this a bug or am I doing something wrong?
If you need any other information, feel free to ask.
Thanks for helping me out!
Best regards,
Daniel
You are missing appropriate inflecting routes that would turn users into Users in order to match the filename UsersController.php, this is evident from looking at the error message which says usersContoller is missing.
It works on your local machine as the default OS X filesystem is by default case-insensitive, unlike the one in Ubuntu, which is case-sensitive.
In case you have updated the core lately the RouteBuilder::fallback() call that is present in the app routes by default may be missing the InflectedRoute argument, which wasn't necessary before.
https://github.com/cakephp/cakephp/commit/5af6464a49204f873aeac52024d295787809822a#diff-37dbf1f85d9888de3ac3c50006f2704f
So, check your routes, and update your app template if necessary.
https://github.com/cakephp/app/commit/4719b42f9db0d80b3dd22edc6a4476566dbb0215
I was using Magento 1.4.1 and upgrade gracefully to 1.4.2. After testing if the upgrade was Ok, I made some modification in order to have a new home page layout for a store using these instruction. The modifications have been tested on a local version (Ubuntu 10.04, php 5.3.2), and worked great.
When I upload the files to the pre-prod server (Centos 5.5, php 5.2.14), and access the System->Configuration->design tab in the admin backend, my browser seems to keep loading indefinitly.
What I have done:
I copied the app/code/core/Mage/Page/* directory to the app/code/local/Mage/Page/;
I created the app/etc/modules/Mage_Page.xml, and defined the codePool to local;
What I have already checked:
I got no errors in /var/log/httpd/*.log;
I got no errors in magento's var/log/system.log;
The frontend works fine;
The backend can be accessed, except the System->Configuration->design tab;
I tried to revert my modifications to a revision before the modification were made (using svn);
I cleaned up the cache using rm -fr var/cache/mage* var/session/* directly on the server;
I restarted the server multiple time;
I even tried to get a dump of the db in production on the preprod server, with no effect. I still got the same issue.
If someone could point out anything I could have forgot.
I am ready to try anything to make it work, since it would not affect the production server for now.
After a lot of searching, we finally tried to reboot the apache server (we had to force it to reboot, I don't know why?). When we retried, everything was working as expected.
There probably was a corruption on the server that made crash only this tag.
Hope this could help someone.