How to cake bake in Linux environment - Cakephp?
I download the latest version from cakephp website. created some tables and trying to bake process but its not working. I try to run cake bake inside cake/console but nothing happens
but in windows we need to set the environment variables like that any settings need for LINUX..
Thanks in advance
First, make sure the script is executable:
cd cake/console
chmod +x cake
Second, make sure that you have the php5-cli installed. The process for this varies by system. Googling "php5-cli" + your distribution name should get you the information.
Third, you don't need to add cake to your path as long as you don't mind navigating to the folder or typing in the full path.
cd cake/console/
./cake bake
export PATH=$PATH:/path/to/your/cakeSiteDir/lib/Cake/Console
cd /path/to/your/cakeSiteDir
cake bake
Worked finally for me and did not close my console with cakephp 2.x
Related
i have to install a plugin on a red hat server where nagios is already configured.
the plugin to be installed is inode_checker which i got from this link
how to install inode checker in nagios
but when i opened this link i could find a shell script here.
now i am not sure whether i have to place the shell script directly on the server in the location /usr/local/nagios/libexec/ or is there any other way to do it since the other plugins available in this location seems to be different and i am not able to open them.
what am i doing wrong here?please advise.
Yes, this is a bash script so simply download and place it in the folder where you have other scripts sitting. Make sure to make it executable like
chmod +x scriptname
Then you should be able to use it in nagios by creating a Command object. You can find the location of the folder where your scripts are located by looking at the resources.cfg file which should hold something like below:
$USER1$=/usr/lib64/nagios/plugins
Hope this helps.
I have been using the cake command on my linux server for 2 years. but now im trying to move to a new server and some how the cake command gives back the error: No such file or directory
even if i give the entire path to the cake command file chmod 777 it stil wont work.
I found the solution: All I had to do is use the program dos2unix the cake file for CakePHP 2.4.2 has wrong endings when you download it with Ubuntu 13.10
I used the following command:
sudo dos2unix /path/to/cake/lib/Cake/Console/cake
I also have this problem on some servers and never figured out why this happened. I suspect the so called "shebang" might not be set correctly for every Linux distribution (e.g. if the cake script stars with #!/usr/bin/env bash, but you don't use bash on your server or your distribution doesn't have the env binary in that path, it might fail on that. This is just a theory though, as I said I never really figured it out, nor did I invest much time in investigating.
Although, what I always use as a fallback is simply calling the cake.php script (from the app folder) instead, like:
php Console/cake.php -app `pwd` bake
That never lets me down. The -app pwd bit is to tell the shell that your current directory is your app directory, so the shell can find all your files.
The REAL solution to this is to change the End-of-Line (EOL) characters to Unix format, instead of MsDos. So I guess this error will only occur if you worked in Windows.
Anyway, teh mighty
SOLUTION:
(1) Open app/Console/cake file using any text editor that allows changing of EOL characters e.g. NotePad++.
(2) In NotePad++ click:
Edit -> EOL Conversion -> Convert to Unix format
(3) Save the file and upload it to the server. Now if you navigate to the CakePHP app directory using command like:
cd /usr/share/nginx/html/cakeproject/app
...you should be able to run Console/cake without any problems and see standard output (basically help commands).
Hope this helped you!
I encountered the same problem as well, but the top answer reminded me of a similar problem I faced before: https://stackoverflow.com/a/5514351/1097483
Basically, instead of using dos2unix or installing it, you can open the file in vim, do
:set fileformat=unix
And save it.
In some versions it's possible to install cake using sudo apt-get install cakephp-scripts.
After instalation, you coud access bake anywere simple by typing bake
Can Any Body Suggest me how to bake the cake in CakePHP 2.x on linux
What I have tried
$ cd MyProject/app/Console
$ ./cake bake
it give me this line, don't know how to proceed from here
Welcome to CakePHP v2.1.3 Console
---------------------------------------------------------------
App : Console
Path: /var/www/MyProject/app/Console/
---------------------------------------------------------------
What is the path to the project you want to bake?
[/var/www/MyProject/app/Console/myapp] >
You're in the wrong path
When you do this:
$ cd /MyProject/app/Console
$ ./cake bake
You're launching the cake cli from inside the Console folder. That's not the right/normal way to execute the cake cli.
As is evident from the output, the cli thinks that you want to bake a new project in the Console folder because the path you are in, is not itself already a project. This changed some months ago, but in the version of cake you're using, the directory you are in, is assumed to be your app folder.
That said, ordinarily cake is used like this:
$ cd /MyProject/app
$ Console/cake bake
Welcome to CakePHP v2.3.6 Console
---------------------------------------------------------------
App : app
Path /var/www/project/app/
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
When already in an app folder - the bake command asks you what you want to create.
I am getting this error when I try to run a CakePHP 2.1 Shell from a cron job:
/bin/sh: /home/[other-folders]/lib/Cake/Console/cake: Permission denied
This is the code I've been using for almost a year with CakePHP 1.3.7 and it worked well. What could the problem be? I've checked the permissions on the cake file, and it is 755, just like the cake file I had in 1.3.7. Thanks!
Are all the directories in the path set to at least +x for the user executing the cron job? If you can't at least execute the directories above cake, you won't be able to execute the program.
Make sure the file path you set in cron is executable:
ls -l /path/to/project/folder/file
chmod +x /path/to/project/folder/file
ls -l /path/to/project/folder/file
So, latest permission will be like -rwxr-xr-x. and things will be working for you. , This solution not only applied to cake but any file you set in cron.
Thats it! Cheers!!
I'm using Hostgator.com and I'm trying to bake apps via ssh console. I have connected successfully to via SSH. I have the cakephp folder located at http://www.domainname.com/cakephp
the initial cakephp installation is working fine. Connected to database etc.
This is a list of paths from Hostgator: List
here is my .bash_profile:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export PS1="$ "
alias www="cd /home/username/public_html"
export PATH="/usr/bin/php/bin:/home/username/public_html/cakephp/cake/console:$PATH:$HOME/bin"
When i open terminal I do this: www [enter] -> cake bake [enter]
then I get this problem: -jailshell: /home/username/public_html/cakephp/cake/console/cake: Permission denied
if anyone could help me it would be greatly appreciated. If I have forgot to mention something please tell me asap so I can tell you.
You need to set the executable flag on the cake script.
www
chmod +x cakephp/cake/console/cake