CakePHP. app/Console/cake: Permission denied for root user - php

I am using CakePHP 2.4.7 and I'm trying to execute CakePHP shell on remote host.
I'm connecting to server as root and then executing $ [path_to_my_foler]/app/Console/cake
The output is: -bash: [path_to_my_foler]/app/Console/cake: Permission denied
How could it be? How to fix it?

Did you get this solve? I think this could do the trick. (Running the command from your app directory
chmod +x Console/cake

In CakePHP Version 3 and above this is the right command.
chmod +x bin/cake
This is CakePHP documentation for reference.
Console
The cake executable has been moved from the app/Console directory to
the bin directory within the application skeleton. You can now invoke
CakePHP’s console with bin/cake.
Documentation link

Related

Error 500 after installing Laravel 5.3

I have a Laravel project (version 5.3) that works well on my localhost (wampserver).
Now I want to run this project on a subdomain of my website.I have ssh root access and a vps user access (not admin - with Directadmin - PHP version 5.4).
I uploaded project files to my server but when I try to see the project result , it gives me a 500 error.
I have tried to change 'storage' folder permissions , so I read this answer , but when I run "chchon" ssh command , I get errors like this :
can't apply partial context to unlabeled file ...
also , I have tested Laravel with version 4.2 and it worked well.
Does any boy have idea ?? Thanks
If you don't have SELinux enabled, you can set permissions simply with chmod or set the owner of the storage directory with chown to the web server's user. (which is probably www-data)
Try to run sudo chown -R www-data storage in the project directory
Try all this
// first delete the vendor folder inside your project root, then run
composer install
// laravel generates log file there
sudo chmod -R 777 storage/logs
// laravel cache the files here
sudo chmod -R 777 bootstrap/cache
// vendor folder, where laravel saves their dependencies
sudo chmod -R 777 storage/ vendor/
// generate a application key
php artisan key:generate
This might help :)

Laravel project not working after successfully installation on the server

I have successfully installed Laravel project on the server but its not working. I am getting error like "page isn’t working
HTTP ERROR 500".
I have execute command
composer create-project --prefer-dist laravel/laravel
and created a directory name Laravel. But it's not working while same thing I have done on my local server and it's working fine.
in local you serve laravel project by internal web server using below command:
php artisan serve
but in your server env you must use apache conf and you must set document root like this:
your_project_directory/public/index.php
if every thing ok till now, your error must made by laravel error handling.
if so, then you can check your laravel log to find out exactly 500 error reason:
go to your project directory, then navigate to storage directory, here is logs directory and it has a laravel.log
tail -f your_project_directory/storage/logs/laravel.log
your generated log are here so read and solve it :)
tips: you must set privilages to your storage directory in server.
I run composer update and it resolve the problem. Known I run the following command from the root path of the application:
It was not the .htaccess file that was the problem nor the index.php. The problem was on accessing the files and requiring permissions.
For solving the problem i ran the following commands through terminal.
sudo chmod 755 -R laravel_blog
and then type below to allow laravel to write file to storage folder
chmod -R o+w laravel_blog/storage
This two commands solved the problem.
Please insert below command and try to access.
setenforce 0
it's working for me.

PHP Laravel: failed to open stream: Permission denied

I am trying to generate email but getting this error:
fopen(/tmp/4701021fcbc23c3a52dde64ccca28857/body): failed to open
stream: Permission denied
Relevant user/group have the permissions but its not working. I used lot of links but none is working.
We are running apache server on linux Ubuntu 14.04.4 LTS and using laravel framework.
Try running this commands in the console, is very important to execute them from your project root directory, if you don't it won't find the specific laravel commands:
cd your_project_path
php artisan cache:clear
chmod -R 777 app
chmod -R 777 storage
composer dump-autoload
I found a similar problem in the laravel.io/forum with further information.
Set up write permissions on storage directory inside your Laravel project directory:
chmod -R 777 storage
You need to access your Laravel project folder so you can run the following command
sudo chmod 777 -R 'your path to project'
Of course you have to replace 'your path to project' with the address of your project folder
for example /var/www/html/LaravelNiceProject
thats it
You can try to write command below to grant your apache user needed privileges:
chown www-data -R storage
Regards dear

WKHTMLTOPDF in Laravel 4.1 PHP5.5 Permission denied

I have implemented wkhtml2pdf through the package laravel-pdf (https://packagist.org/packages/ignited/laravel-pdf) which makes use of a slim wrapper around wkhtmltopdf written by Michael Haertl (https://packagist.org/packages/mikehaertl/phpwkhtmltopdf)
It used to work fine. Then I upgraded to PHP5.5 and Laravel 4.1.
Now I get the following error:
Could not run command '' --bin '/var/www/docassembly/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64' /tmp/tmp_WkHtmlToPdf_f0LNZv.html /tmp/tmp_WkHtmlToPdf_gJY5R6: sh: 1: : Permission denied
It looks like Apache doesn't have the permissions to execute the binary.
The binaries are owned by the apache user and are 777. It does write an empty file to the tmp directory though. The /tmp folder is also 777 and owned by apache user.
When I run the command manually in the terminal, it works as expected.
Any ideas?
First check what is the file permission with command
ls -l /var/www/docassembly/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64.
Should be
-rwx------ 1 www-data www-data 38824584 Aug 17 00:40 wkhtmltopdf-amd64.
If not change with command
chmod 700 /var/www/docassembly/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64.
Hope this helps.

Symfony 2.3 Failed to remove file with php composer.phar update

I am following the guide on symblog: http://tutorial.symblog.co.uk/docs/doctrine-2-the-blog-model.html
I am trying to run: $ php composer.phar update after updating the composer.json but get the following error:
[Symfony\Component\Filesystem\Exception\IOException]
Failed to remove file
"/var/webroot/vhosts/mysite.co.uk/htdocs/Symfony/app/cache/dev_old/profiler/32/95/639532"
The permissions on this file is: 0644 were the owner is www-data and the group is sambashare which includes the user i am ssh'd in as (john).
As this is running php from command line, is php being run as 'john' thus in the group of the file wanting to be removed but not the user?
The runtime error at the end it:
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
After a bit of searching some people have just said clear this cache manually.. but how can i fix this issue at the root so i do not have to do this manually?
Thanks,
John
This is a common problem with Symfony2 you should run your commands under the apache2 user in most cases this is the www-data user.
You can switch to the www-data user with
su www-data -s /bin/bash
then you should set 755 to the cache folder that the www-data has enough permissions. There is a goof explanation in the Symfony2 documentation about that.
http://symfony.com/doc/current/book/installation.html
Here in the documentation is a section "Setting up Permissions" there you can see how you can configure ACLs and other user permissions.
The problem is PHP console commands use php-cli running under the current user as opposed to the web server's user (usually www-data), leading to permission errors.
The Symfony book explains several ways to avoid the issue.

Categories