I've recently been given the job to move a website from one server to another. This site uses the Cake PHP framework (disclaimer: I've never used Cake before). After I copied all databases and files I am having trouble getting the site to load. It is giving the following error:
Fatal error: Class 'Router' not found in /sitepath/cake/dispatcher.php on line 283
The following code is on line 283: $namedExpressions = Router::getNamedExpressions();
From what I read this error is occurring because App::import('Core', array('Router', 'Controller'));, which is in the same file, is not working correctly. In fact if I var_dump() the App::import line I can see that it returns false. So I can only assume App::import should not be returning false, right? I'm guessing my problem is that something is configured wrong in the Cake config settings, maybe a default path? The only thing I've really changed in the config settings is the database credentials, I've updated them for the new database on the new server. So if someone could point me in the right direction and let me know if I have something configured wrong that would be great. Thanks.
Also, I should note this is using Cake 1.3.
/app/tmp/cache/persistent
This directory contains a bunch of files, one of the files is:
cake_core_core_paths
This file contains a serialized array with information that is automatically "cached" in this file. Some of that information includes default paths. When I initially opened this file I could see some of my default paths were set to the old server. Once I deleted this file, then refreshed the page, a new file was created with the correct paths and everything worked as expected. So basically the problem was App::import could not load the correct file because it was using the wrong file path.
Related
I´m new in PHP and creating dynamic webpages and after I installed Apache and my PHP IDE(codelobster) I face a serious problem.I really don´t know what I´m doing wrong but when I create new PHP project and I try to open it via my browser through localhost/...it always return me back a error page with this description:
Error:Missing controller
Cake\Routing\Exception\MissingControllerException
My php file is called oneironaut.php so it gives me also:
Oneironaut.phpController could not be found.
In the case you tried to access a plugin controller make sure you added it to your composer file or you use the autoload option for the plugin.
Error: Create the class Oneironaut.phpController below in file:
src\Controller\Oneironaut.phpController.php
I tried to create different projects like with different names and there was always this bug diference only with name of my .php webpage.So I think this must be some system error and something in my xampp/php or Apache settings must change.Maybe there could be some connection with my unfunctional debugger , I tried to download Xdebug from https://xdebug.org/wizard.php and even though I follow instructions on this website and another websites too I can´t successfully get xdebug extensions into my computer.So in this some help will be highly appreciated too.
So give me someone please help what to do with these problems? Thank You so much.
This seems to be happening because the server is loading files in "case-sensitive" mode.
You call your PHP file "oneironaut.php", however, the page is looking for "Oneironaut.php"
A similar question has been answered here, please try:
Missing Controller Error on remote server using Beta 3
I´m moving an application from a PHP 5.5 server to a PHP 5.6 server. The application is based on Codeigniter 2.2.
On the old server I had something like this in my views to include other template parts:
include('header.php');
This simple and direct include works like a charm on the old server.
On the new server I get the exception, that the file for inclusion could not be found.
I found out, that the PHP preprocessor tries to grab the file from the linux include paths and also from the "system/core" directory. But not from the directory where the view itself is located.
I´ve not idea what makes the difference between these two systems... Has anybody an idea where I can search for the issue?
Check the file path. Whether its inside some other folder or not.
Also can try with
$this->load->view('header.php');
or can load header in Controller as well
As well there are some useful keyword.
APPPATH - Outputs application path. Ex application/
Thanks guys for all your input - I´ve already tried most of these debugging attempts.
Now I digged a little deeper and found the reason for my problems. The short_open_tag directive in PHP caused the issue. Cause this new server had some slight differences in php.ini.
In core/loader.php Codeigniter tries to replace short open tags with normal tags, if the .ini setting for short_open_tags is disabled. For any reason this replacement isn´t working as expected and that caused my issues.
So if anyone has the same issue after moving a Codeigniter installation from one machine to another, that might be a point where you can start.
Thanks to all of you,
Michael
The default file layout of MediaWiki seems quite insecure and good apps expose a single directory (and not the entire hierarchy) to http requests. I've tried to follow instructions found on: https://www.mediawiki.org/wiki/Manual:Security#Alternate_file_layout
And created a /web directory under the base installation directory /wiki and in it created two new files /wiki/web/index.php that looks like
<?php
chdir('../');
require_once 'index.php';
A similar /weiki/web/load.php was created. I've also added a soft link to the resources directory so /wiki/web/resource is actually /wiki/resources
The first request on the wiki (after restarting the server and setting the document root to /wiki/web instead of /wiki) does respond and shows the page well. However, subsequent responses produce a blank page with code 200 (success). Nothing comes up in the PHP error log either. As this happens after subsequent restarts I suspect some caching mechanism isn't working properly.
Any ideas on how to find the cause of the problem?
That chdir('../'); doesn't sound right. You should use an absolute path as demonstrated in the manual you linked, apparently in your case chdir('/wiki/web/');
However, before going through such adventures, I hope you protected the actually sensitive paths like configuration files, uploads and cache... (See the manuals for the setup of those.)
I'm trying to get a file's content into a variable but I don't get anything when I read the file. I used both methods JFile::read() and file_get_contents() but both return the same thing: a blank string, not an error , not any boolean values or anything.
I want to mention that I'm working on a Linux machine (just for 2 days) and recently I changed the permissions for the entire machine to 777 ( I don't know if this affects something or not).
Is the a connection between my OS, permissions and the php's file_get_contents()? or Joomla restricts file reading?
Also I want to mention that my file_get_contents() function was added manually by me in the index.php file , also the file I want to read was manually added in the same folder with index.php.
We had the same problem with one of our clients, it turned out it was a firewall issue. It was very hard to debug this issue. I suggest you check with your networking team.
I am assuming, of course, that you have set the PHP error reporting level to the maximum and that you have checked the error logs.
It seemed the problem was from my system . I messed it up when I changed the permissions so I have to re-install it.
Never change the permissions on a Linux for the entire file system.
I'm trying to set up my Flex Builder 4 dev environment, up to and including PHP and the ZendFramework on a WAMP stack on my hard drive.
Everything goes swimmingly until I try to set up a data service. I point it to the php class file, it populates the various fields in the form so I know it understood it, and I press next. After a little bit of tweaking I have the ZendFramework installed and everything seems to be pointing the right way, so I'm not sure why I'm getting this error:
"Make sure that Zend Framework is installed correctly and the parameter "amf.production" is not set to true in the amf_config.ini file located in the project output folder.
Warning: include_once(C:\wamp\www\TestDrive-debug\EmployeeService.php) [function.include-once]: failed to open stream: Permission denied in C:\wamp\ZendFramework\library\Zend\Loader.php on line 146"
What could be causing a permissions error like that? It's not on the system level because I went into properties and fully opened that file up so even a basic user has full permissions - still no dice.
I'm not reeeally a PHP guy so this is a bit beyond my skillset. Has anyone encountered this problem before? I'm just following the tutorial I have here and it SHOULD work. I'm just not clear on what would be causing a permissions issue like this.
Thanks!
I resolved this problem by changing the encoding of the php file. There must be some invisible characters in the file that were screwing up the parsing. Try saving the php service file with different encoding and see if it works for you. The one that worked for me was created by eclipse. I copy pasted the code in it, saved, and boom it worked!
just had same issue and resolved same as OP, just resave file with notepad, funny deal, but it happens
inside the folder of amf_Config.ini , create a new file amf_config2.ini , copy the contents of amf_config.ini as it is into amf_config2.ini , now inside amf_config2 double quote the value of parameter webroot (webroot="xxxxx") save ur amf_config2 , open gateway.php which would be also inside the same dir , change $configfile = "$dir/amf_config.ini" to
$configfile = "$dir/amf_config2.ini" , save it and try