Missing Controller Error on remote server using Beta 3 - php

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

Related

Cannot load custom routes in Phalcon PHP

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.

Running Wordpress repo locally through MAMP. Assets not being pulled in

Currently I am trying to run a Wordpress repo locally for development. I am not using MAMP pro even though I still have a 9 day trail. I figured since I'm going to be using the free version for now I might as well work with that. I have my Apache & MySQL server running along with the Document Root pointing to my Sites folder where my projectName repo sits. I'm still running off of the default port of Apache 8888.
After I start the servers, I open WebStart and import my DB into phpMyAdmin. Everything works perfectly fine and the copy of my db gets imported. I then make sure that my wp-config.php file has the appropriate settings to access this db. I then click on My Website. This pulls up the content of the website. However, it does not pull in any of the assets(imgs/js/css). I receive the following errors in the console:
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/uploads/2016/09/logo-footer-1.png
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/themes/projectName/images/circle.png
And so the list goes on and on for pretty much every asset the project could possibly have. Now configuration is NOT my strong suit, and at this point I am at a loss of what could possibly be happening. Awhile ago I did follow a tutorial on how to setup my files so that I can access them in the web browser by simply typing the name of the project with the domain .dev, example: projectName.dev. I started having issues with this after upgrading to OS Sierra and it no longer works. Could this possibly be the reason as to why it is looking for these assets in the projectName at the .dev domain?
I apologize if this does not make sense. I am willing to provide anyone with any information on this as I need as much help as possible because I still need to level up my configuration skills. Let me know if you have questions.
The images and other assets are referenced with an absolute filepath (i.e. the URL of the server on which you first set it up). This has to be changed in all database entries. There are tutorials for this on the net, but the most simple version is to open the sql file in an editor and search & replace the general URL part in the complete database.
Be sure to keep a backup of the file - that might not work on the first try...

Failing at getting Laravel Running on Windows

I'm trying to get a laravel programming enviroment up to finish my masters' degree project but I can't get this to work no matter how hard I try.
I've followed various tutorials but the last one I've tried has been http://sherriflemings.blogspot.com.es/2015/03/laravel-homestead-on-windows-8.html
and I think I got somewhere but I get the following error trying to initialize vagrant
Vagrant up error:
and I've confirmed that the file C:\Users\Administrator\homestead\Homestead\scripts\homestead.rb is available and permissions are correct.
Also In the error I see C:/Users/Administrator/.ssh/id_rsa (Errno::ENOENT)
but I have other routes difined in my Homestead.yaml
Is there any other way I can run homstead of have a Laravel development enviromet?
What tutorial would you recommend to get this up and running?
You should generate key to make it work. So, you will have two files
id_rsa and id_rsa.pub in your C:/Users/Administrator/.ssh/ folder.
As I totally agree with the previous answer, I wanted to provide some more information about your state.
There is no need to check if the homestead.rb exists at that stage. Because it is already the running code and informing you about the problem that it can't fix by herself.
That is also not a route problem (to tell the truth; the provided information under 'sites' key of Homestead.yaml is not about routes. You are listing the projects inside your homestead virtual machine there. One site per project is generally enough. Like:
-sites:
- map: foo.com
- to: /home/vagrant/Code/Foo/public
Your homestead.rb file is blocked while running because the created virtual machine's operating system needs something to trust your code working using ssh. And one of the ways of achieving that is using a public key - private key pair (also used by homestead). It looks like you don't have a pair. And the script running can't access the public key: AKA id_rsa.

Codeigniter Rest Server denies just one request

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

Laravel 4 - Local to Staging 404 issue

I hope that this isn't too broad a question but I have been developing a site locally for a month or so and am ready to put it up on my staging server. The deployment all went smoothly after a little issue installing Mcrypt but all is good now, except for in my staging environment I get a 404 on every route.
They way my application is structured is I have folder in app that contains each of my modules, each module (Users, Auth, Teams etc.) each have their own routes.php file aswell as controllers/models/repositories etc.
If I access the site using say /login I recieve a 404, however, If i was to quickly create that route in the main routes.php file in app/ it works which is leading me to believe that for some reason the server isn't loading the individual modules files.
Can you give me a hand narrowing it down, what sort things should I look at etc?
Thanks in advance.
Ok so I found out the issue.
For some reason my local (homestead) environment wasn't too bothered about case sensitivity, however, my staging server was. A few tweaks and I am up and running, cheers for the ideas though :)

Categories