Doctrine CodeIgniter error: Your proxy directory must be writable - proxy

I use Doctrine 2.0 integration with CodeIgniter.
I encounter this error when try to load something from the DB.
Fatal error: Uncaught exception 'Doctrine\ORM\Proxy\ProxyException' with message 'Your proxy directory must be writable.' in /opt/lampp/htdocs/khoone/application/libraries/Doctrine/ORM/Proxy/ProxyException.php:37 Stack trace: #0 /opt/lampp/htdocs/khoone/application/libraries/Doctrine/ORM/Proxy/ProxyFactory.php(189): Doctrine\ORM\Proxy\ProxyException::proxyDirectoryNotWritable() #1 /opt/lampp/htdocs/khoone/application/libraries/Doctrine/ORM/Proxy/ProxyFactory.php(90): Doctrine\ORM\Proxy\ProxyFactory->_generateProxyClass(Object(Doctrine\ORM\Mapping\ClassMetadata), 'application/mod...', '<?php??namespac...') #2 /opt/lampp/htdocs/khoone/application/libraries/Doctrine/ORM/UnitOfWork.php(2576): Doctrine\ORM\Proxy\ProxyFactory->getProxy('Entity\Account', Array) #3 /opt/lampp/htdocs/khoone/application/libraries/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php(135): Doctrine\ORM\UnitOfWork->createEntity('Entity\User', Array, Array) #4 /opt/lampp/htdocs/khoone/application/libraries/Doctrine/ORM/Internal/Hydration/SimpleObje in /opt/lampp/htdocs/khoone/application/libraries/Doctrine/ORM/Proxy/ProxyException.php on line 37
I have configured Doctine as below:
$models_namespace = 'Entity';
$models_path = APPPATH . 'models';
$proxies_dir = APPPATH . 'models/Proxies';
$metadata_paths = array(APPPATH . 'models/Entity');
and already tried this:
sudo chmod 777 myapp/application/models/Proxies
but I face the error anyway.
any Idea what might the problem is?

I had the same problem. To fix it, I deleted a folder named "Cache" which was located in my folder "Data", and it works.

Related

Uncaught RuntimeException on laravel 6

I am facing an error in Laravel 6. How can I solve this?
Fatal error: Uncaught RuntimeException: Directory name must not be
empty. in
D:\Xampp\htdocs\tolet\vendor\symfony\finder\Iterator\RecursiveDirectoryIterator.php:54
Stack trace: #0
D:\Xampp\htdocs\tolet\vendor\symfony\finder\Iterator\RecursiveDirectoryIterator.php(54):
RecursiveDirectoryIterator->__construct('', 4096) #1
D:\Xampp\htdocs\tolet\vendor\symfony\finder\Finder.php(669):
Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator->__construct('',
4096, false) #2
D:\Xampp\htdocs\tolet\vendor\symfony\finder\Finder.php(571):
Symfony\Component\Finder\Finder->searchInDirectory('') #3
D:\Xampp\htdocs\tolet\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\LoadConfiguration.php(76):
Symfony\Component\Finder\Finder->getIterator() #4
D:\Xampp\htdocs\tolet\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\LoadConfiguration.php(59):
Illuminate\Foundation\Bootstrap\LoadConfiguration->getConfigurationFiles(Object(Illuminate\Foundation\Application))
#5 D:\Xampp\htdocs\tolet\vendor\laravel\framework\src\I in D:\Xampp\htdocs\tolet\vendor\symfony\finder\Iterator\RecursiveDirectoryIterator.php
on line 54
The error tells you that a directory name is empty. You will need to make sure that the directory name in use has a value. Check your configuration for directory names and see whether there is any of them not configured. Ask your teammates whether some new configuration items were added that they did not let you know about so far.
But most importantly, debug your code, at the very least log some values while you are working on this at the lines pointed out by the stack trace to find out what's missing. Once you know what's missing, just make sure it will not be missing at the next load.

Solve facade root has not been set

I have uploaded my laravel app on cpanel so its showing this error when i try to visit the domain
Fatal error: Uncaught RuntimeException: A facade root has not been set. in /home/eswdistr/public_html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:234 Stack trace: #0 /home/eswdistr/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(401): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac...', Array) #1 /home/eswdistr/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(378): Illuminate\Foundation\Exceptions\Handler->registerErrorViewPaths() #2 /home/eswdistr/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(293): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException)) #3 /home/eswdistr/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(190): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Symfony\Component\HttpKernel\Exception\HttpEx in /home/eswdistr/public_html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 234
`
You did not upload the vendor directory.
Ensure you have uploaded the vendor folder.

Bugsnag error when running artisan command

I got this error when trying to run my php artisan migrate on my production server...
PHP Fatal error: Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
Stack trace:
#0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client->__construct(NULL)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider->Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build(Object(Closure), Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('bugsnag', Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application->make('bugsnag', Array)
#5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
PHP Fatal error: Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
Stack trace:
#0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client->__construct(NULL)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider->Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build(Object(Closure), Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('bugsnag', Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application->make('bugsnag', Array)
#5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
I ran env on the command line and I have an env variable called BUGSNAG_API_KEY and the value of it exactly matches the key at bugsnag.com for this project.
Furthermore, I have this line in my project at ./config/bugsnag.php
'api_key' => env('BUGSNAG_API_KEY'),
Weirdly, I eventually tried the same command again (php artisan migrate) and it worked! But it's left me very unsettled as it's a production server. So I'd like to understand the problem.
Errors seem to be logging in Bugsnag as well by the way.
Try to regenerate the configuration cache with php artisan config:cache. It will use the current data from the .env file to generate a new configuration cache. This worked for me.
In case this helps anyone...
The Bugsnag Git Repo mentions this issue:
(Uncaught exception 'ReflectionException' with message 'Class bugsnag.logger does not exist'
Github user GrahamCampbell suggested that what is actually happening is that another error exists, but it's "...trying to log to bugsnag which is causing this error, which is hiding the real error". I confirmed this was my issue by doing what user russianryebread suggested, which was to manually copy the bugsnag.php config file over to the Laravel /config directory. Once I did that now my real error shows:
[Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected '{'
Now to troubleshoot this issue :)
Hope this helps!

Blank white page when finished uploading files to server laravel5

I have finished uploading files to server inside demo folder, but when i visited i got blank white page. when i visited somedomain.com/demo i got blank white page. Can anyone help me please. My folder directory start with demo. Inside demofolder i have app,bootstrap,config etc folders.
when i view storage/log file i got
[2015-09-20 06:38:00] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:52:16] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:53:23] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:58:28] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
The blank page suggests a 500 error and your logs back this up.
Looking at your logs it is an issue with the vendor/compiled.php file.
Just delete this file, run composer update, and then php artisan optimize after the update to rebuild compiled.php.
On a side note, the URL to view this should be somedomain.com/demo/public as this is where the index.php file is located - unless you have already dealt to this.
When you move Laravel 5 to a production server please do the following:
Change permissions of storage and bootstrap folders to 0755 or 0777 chmod -R 0777 storage/
composer install
composer update
artisan cache:clear
This will resolve your dependencies and make laravel functional.
When you get packages conflicts after doing the above steps remove the packages from app/config/app.php and delete their folders from vendor and run composer update.
Also make sure you will meet Laravel 5 minimum requirements. PHP 5.5.9 is required.

Yii 2 The directory does not exist on shared enviroment

I have problem with my web site, when i try to access it says
Fatal error: Uncaught exception
'yii\base\InvalidParamException' with message 'The directory does not exist: C:\HostingSpaces\zerguttnalog\zergutt.com'
in C:\HostingSpaces\zerguttnalog\zergutt.com\vendor\yiisoft\yii2\base\Module.php:224 Stack trace:
#0 C:\HostingSpaces\zerguttnalog\zergutt.com\vendor\yiisoft\yii2\base\Application.php(358): yii\base\Module->setBasePath('C:\\HostingSpace...')
#1 C:\HostingSpaces\zerguttnalog\zergutt.com\vendor\yiisoft\yii2\base\Application.php(223): yii\base\Application->setBasePath('C:\\HostingSpace...')
#2 C:\HostingSpaces\zerguttnalog\zergutt.com\vendor\yiisoft\yii2\base\Application.php(202): yii\base\Application->preInit(Array)
#3 C:\HostingSpaces\zerguttnalog\zergutt.com\wwwroot\index.php(12): yii\base\Application->__construct(Array)
#4 {main} thrown in C:\HostingSpaces\zerguttnalog\zergutt.com\vendor\yiisoft\yii2\base\Module.php on line 224.
On my local machine everything is ok (xampp on windows), i don't know what is happening on the server. Can anyone help?
Apparently you have set the base path of your application to (C:\HostingSpace..), it will work fine on your local machine because the directory exists, but on a different server yii will not find this directory.
Check your configuration files, you will fine a line starts with.
'basePath' => ... you need to change it to 'basePath' => dirname(__DIR__), and hopefully it will work fine.

Resources