CakePHP: Could not load configuration file - php

I'm trying to get a cakephp project up and running from a svn checkout on my mountain lion computer.
I changed all the cache write permissions find but now I have one last fatal error that's not letting the app run.
Fatal error: Uncaught exception 'ConfigureException' with message 'Could not load configuration file: /Users/mike/cake2cribs/cake2cribs/app/Config/core-production.php' in /Users/mike/cake2cribs/cake2cribs/lib/Cake/Configure/PhpReader.php:77
Stack trace: #0
/Users/mike/cake2cribs/cake2cribs/lib/Cake/Core/Configure.php(267):
PhpReader->read('core-production') #1
/Users/mike/cake2cribs/cake2cribs/app/Config/core.php(287):
Configure::load('core-production') #2
/Users/mike/cake2cribs/cake2cribs/lib/Cake/Core/Configure.php(76):
include('/Users/mike/cak...') #3
/Users/mike/cake2cribs/cake2cribs/lib/Cake/bootstrap.php(146):
Configure::bootstrap(true) #4
/Users/mike/cake2cribs/cake2cribs/app/webroot/index.php(81):
include('/Users/mike/cak...') #5 {main} thrown in
/Users/mike/cake2cribs/cake2cribs/lib/Cake/Configure/PhpReader.php on
line 77
it fails on this line inside index.php inside webroot
if (!include ('Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
Any ideas as to what could be the cause?

I've never done an Ubuntu install, I've always just downloaded the source and put it in my webroot. Anyway, cake always expects to have a file called core.php which holds all the config info. Maybe the Ubuntu install just expects core-production.php, so you might just need to copy the core.php file in app/Config and rename it to core-production.php.

Related

Phalcon - Class "Phalcon\Config" not found

I've installed Phalcon and trying to create new project: phalcon project store. But instead of this I get these errors:
PHP Fatal error: Uncaught Error: Class "Phalcon\Config" not found in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php:48
Stack trace:
#0 C:\Composer\vendor\phalcon\devtools\src\Commands\Builtin\Project.php(74): Phalcon\DevTools\Builder\Component\AbstractComponent->__construct(Array)
#1 C:\Composer\vendor\phalcon\devtools\src\Script.php(109): Phalcon\DevTools\Commands\Builtin\Project->run(Array)
#2 C:\Composer\vendor\phalcon\devtools\src\Script.php(148): Phalcon\DevTools\Script->dispatch(Object(Phalcon\DevTools\Commands\Builtin\Project))
#3 C:\Composer\vendor\phalcon\devtools\phalcon(65): Phalcon\DevTools\Script->run()
#4 {main}
thrown in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php on line 48
Fatal error: Uncaught Error: Class "Phalcon\Config" not found in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php:48
Stack trace:
#0 C:\Composer\vendor\phalcon\devtools\src\Commands\Builtin\Project.php(74): Phalcon\DevTools\Builder\Component\AbstractComponent->__construct(Array)
#1 C:\Composer\vendor\phalcon\devtools\src\Script.php(109): Phalcon\DevTools\Commands\Builtin\Project->run(Array)
#2 C:\Composer\vendor\phalcon\devtools\src\Script.php(148): Phalcon\DevTools\Script->dispatch(Object(Phalcon\DevTools\Commands\Builtin\Project))
#3 C:\Composer\vendor\phalcon\devtools\phalcon(65): Phalcon\DevTools\Script->run()
#4 {main}
thrown in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php on line 48
My PHP version is 8.0.8 Thread Safe x64, I've installed PSR extension and Phalcon 5.0.0 from here: https://github.com/phalcon/cphalcon/releases/tag/v5.0.0beta3, file phalcon-php8.0-ts-windows2019-vs16-x64.zip, that means I have compatible version of framework. phalcon.bat was added to environment variables. What's the problem?
Usually this error occurs when the extension is not loaded by php, see with phpinfo(), also run the componser install insider phalcon-devtools, but probably it is the php not loading the phalcon extension or PHP is not in the windows PATH , also check if the php-fpm log does not contain any extension loading errors, test in cmd the command php -v
also create a index.php and try it
<?php
use Phalcon\Mvc\Micro;
$app = new Micro();
$app->get('/', function () { echo "<h1>test</h1>";});
$app->handle();
Try do the following Go to Edit The system environment variables -> system variables -> path -> edit add phalcon.bat folder path testing here i used C:\Users\renato\Downloads\phalcon-devtools-4.2.0\phalcon-devtools-4.2.0 ( just path folder where the .sh/.bat it is, do not include the file and extension) and worked fine with php 8.0.16 windows 10 phalcon 5
and then go to the power shell and input phalcon
https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/
Do not forget to run composer install inside phalcon devtools folder.
also on powershell input php -m to see the loaded modules and if it has an error

Laravel Cannot declare class Symfony\Component\HttpFoundation\AcceptHeader, because the name is already in use

I just took a project from a couple of months ago which was made in Laravel. This project also utilizes Laravel Voyager - the admin panel package.
After browsing to http://example.com/admin, I got this weird error which came out of nowhere and I'm also unsure how to debug it. It looks like this:
Fatal error: Cannot declare class Symfony\Component\HttpFoundation\AcceptHeader, because the name is already in use in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php on line 22
Fatal error: Uncaught Error: Class 'Symfony\Component\HttpFoundation\AcceptHeaderItem' not found in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php:61 Stack trace: #0 [internal function]: Symfony\Component\HttpFoundation\AcceptHeader::Symfony\Component\HttpFoundation\{closure}(Array) #1 /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php(57): array_map(Object(Closure), Array) #2 /c/Users/User/Code/example-website/vendor/symfony/http-foundation/Request.php(1664): Symfony\Component\HttpFoundation\AcceptHeader::fromString('text/html,appli...') #3 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php(54): Symfony\Component\HttpFoundation\Request->getAcceptableContentTypes() #4 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php(44): Illuminate\Http\Request->wantsJson() #5 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illumina in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php on line 61
This error is very expected and I've never seen it before in my project (or anywhere else for that matter).
How can I debug this issue?
As a sanity check, delete the vendor directory and then run composer install to re-fetch your dependencies and see if the error is resolved. If not, then attempt composer update to fetch the latest versions of your dependencies in which this issue may have been resolved.

php fopen() permissions issue

I looked everywhere on the web and just couldn't find a solution.
I am getting this error:
Warning: fopen(/var/www/html/includes/../log/404/log_2018-04-07.txt): failed to open stream: Permission denied in /var/www/html/vendor/katzgrau/klogger/src/Logger.php on line 167
Fatal error: Uncaught exception 'RuntimeException' with message 'The file could not be opened. Check permissions.' in /var/www/html/vendor/katzgrau/klogger/src/Logger.php:134 Stack trace:
#0 /var/www/html/includes/db_class.php(7204): Katzgrau\KLogger\Logger->__construct('/var/www/html/i...')
#1 /var/www/html/includes/db_class.php(7217): db_class->getLogger('404')
#2 /var/www/html/includes/furl_router.php(55): db_class->logger('404')
#3 /var/www/html/includes/furl_router.php(229): goTo404('no page-data / ...')
#4 /var/www/html/index.php(17): require_once('/var/www/html/i...')
#5 {main} thrown in /var/www/html/vendor/katzgrau/klogger/src/Logger.php on line 134
From what I read here it's a permission issue but I can't figure it out. I granted all permissions from root folder, I have no idea what am I doing wrong.
Check folder write permissions. Maybe the user trying to write the log has no permissions. sudo chmod -R 666 logs gives read and write permissions to all users.
For anyone using Katzgrau\KLogger\Logger and using relative paths to locate the log file, use an absolute path, e.g.:
$logger = new Logger(__DIR__ . '/../../logs');
After reading a bit about another issue I had but with a MySQL function, after exploring, I figured out I should use MySQL version 5.6 while I used version 5.7.
I uninstalled MySQL 5.7 and install 5.6 instead. It solved both the MySQL issue and the issue mentioned above.

Trouble getting cakephp 2.4.0 running - fatal errors when attempting to complete tutorial

I am trying to follow the instructions for the cakephp tutorial found here: http://book.cakephp.org/2.0/en/getting-started.html
I uploaded the CakePHP files to my webserver, created the database using MySQL workbench, and created database.php and updated it to point to my MySQL server.
At this point it sounds like I should be able to open up the website in my browser and see something, but instead I get these errors (I have removed the full path):
Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /caketut/lib/Cake/Cache/Cache.php on line 325
Warning: caketut/app/tmp/cache/persistent/ is not writable in /www/premium/med/pediatrics/www.hobmt.umn.edu/htdocs/caketut/lib/Cake/Cache/Engine/FileEngine.php on line 380
Fatal error: Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /caketut/lib/Cake/Cache/Cache.php:181
Stack trace:
#0 /caketut/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_')
#1 /caketut/app/Config/core.php(367): Cache::config('_cake_core_', Array)
#2 /caketut/lib/Cake/Core/Configure.php(72): include('/www/premium/me...')
#3 /caketut/lib/Cake/bootstrap.php(177): Configure::bootstrap(true)
#4 /caketut/app/webroot/index.php(92): include('/www/premium/me...')
#5 {main} thrown in /caketut/lib/Cake/Cache/Cache.php on line 181
I tried setting the permissions for the Cache folder located in /caketut/lib/Cake and all subfolders/files to be 0776, and this removes all errors except this one:
Fatal error: Class 'Cache' not found in /caketut/app/Config/core.php on line 361
I tried doing searches but was unsuccessful in finding a solution. I would really appreciate any assistance!
try to chmod the whole script with 0777 permissions .
sudo chmod -R 0777 caketut

Unable to write cache folder for smarty project on pagodabox

I have created project in smarty and now i am trying to host it on pagodabox.com. I have created application on pagodabox.com and uploaded all code on to this application but problem is this now i am unable to configure cache and compiler directory in pagodabox.com that's why it output fetal error because cache and compiler directory is read only mode. I have try Boxfile to resolve this issue but failing to solve. I am not aware how i can make these directory writable. please help me. this is url of project http://moviestock.pagodabox.com/ and following is my Boxfile configuration
web1: #component type & number
name: blog #component settings
shared_writable_dirs:
- var/secured/cache
- var/secured/compiler
- var/sessions
document_root: app
php_version: 5.3.8
and i am getting this following error :
Fatal error: Uncaught exception 'SmartyException' with message 'unable to write file
shared/secured/compiler/wrt50c17dfaca2932.90478039' in
/var/www/libs/sysplugins/smarty_internal_write_file.php:44 Stack trace: #0
/var/www/libs/sysplugins/smarty_internal_template.php(201):
Smarty_Internal_Write_File::writeFile('shared/secured/...', 'compileTemplateSource() #2
/var/www/libs/sysplugins/smarty_internal_templatebase.php(374):
Smarty_Internal_TemplateBase->fetch('extends:layout....', '6666cd76f969564...', NULL,
NULL, true) #3 /var/www/classes/BaseController.php(22): Smarty_Internal_TemplateBase-
>display('extends:layout....', '6666cd76f969564...') #4
/var/www/secured/controllers/HomeController.php(6): BaseController->render('home') #5
[internal function]: HomeController->indexAction('') #6
/var/www/classes/Router.php(26): call_user_func_array(Array, Array) #7
/var/www/index.php(10): Router::run() #8 in
/var/www/libs/sysplugins/smarty_internal_write_file.php on line 44
I think it has to do with the filepath that smarty is trying to write to. In the error, the filepath is shared/secured/compiler/wrt50c17dfaca2932.90478039. It should be var/secured/compiler/wrt50c17dfaca2932.90478039
Not sure but maybe #chmod(PATH,0770); will make a trick?

Categories