How to deploy CakePHP-application on CentOS? - cakephp

I almost managed to deploy a CakePHP-application on CentOS-server, but it still needs little configuration. I have enabled mod_rewrite in /etc/httpd/conf/httpd.conf and restarted apache-server.
Then I have put Cake core library in /home/user/cakephp-core/
I get message "500 internal error" when i try to go to this page through web-browser.
In apache-logs I found following messages:
PHP Warning: include(/$HOME/cakephp-core/lib/Cake/bootstrap.php): failed to open stream: Permission denied in /srv/www/site/public_html/main/index.php on line 96
PHP Warning: include(): Failed opening '/$HOME/cakephp-core/lib/Cake/bootstrap.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /srv/www/site/public_html/main/index.php on line 96
PHP Fatal error: CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /srv/www/site/public_html/main/index.php on line 101
it says something about "permission denied"... to whom I should give permissions and where? I gave "apache:apache" to tmp/-folder... Any ideas?

Simply read the log and try to understand it.
It pretty clearly tells you what has insufficient permissions. The linux command to set permissions is chmod. You also want to make sure, as the text already tells you, that your CakePHP core include path is correct. Double check that too.

Related

SnowSQL - Getting permission denied error

I'm kinda new to SnowFlake. I've installed SnowSQL but when I'm trying to launch it's throwing the below error: I guess some issue in the config which I'm unable to figure out. Please advise!
PermissionError: [WinError 5] Access is denied: '%USERPROFILE%'
[27056] Failed to execute script bootstrap
It looks like the configuration​ options log_file and log_bootstrap_file also point to the %userprofile% directory by default. Maybe set those to the network location too? You can do this by putting the options in the config file or using the -o flag when calling the CLI as described here: https://docs.snowflake.net/manuals/user-guide/snowsql-config.html#snowsql-config-file

Cake bake is not letting me bake models and does not recognise fields in my tables

I'm trying to bake some models that I started this morning, everything was fine then until I had to leave, so I did ctrl^c and exited Putty. Since logging back in everything seemed fine, except when I did ./cake bake and I got the following errors and warnings:
PHP Warning: SplFileInfo::openFile(/var/www/vhosts/toast.lancs.ac.uk/httpdocs/jahans/Wimbrick/app/tmp/cache/persistent/myapp_cake_core_file_map): failed to open stream: Permission denied in /var/www/vhosts/toast.lancs.ac.uk/httpdocs/jahans/Wimbrick/lib/Cake/Cache/Engine/FileEngine.php on line 355
Warning: SplFileInfo::openFile(/var/www/vhosts/toast.lancs.ac.uk/httpdocs/jahans/Wimbrick/app/tmp/cache/persistent/myapp_cake_core_file_map): failed to open stream: Permission denied in /var/www/vhosts/toast.lancs.ac.uk/httpdocs/jahans/Wimbrick/lib/Cake/Cache/Engine/FileEngine.php on line 355
Warning Error: _cake_core_ cache was unable to write 'cake_dev_eng' to File cache in [/var/www/vhosts/toast.lancs.ac.uk/httpdocs/jahans/Wimbrick/lib/Cake/Cache/Cache.php, line 323]
Warning Error: _cake_core_ cache was unable to write 'cake_console_eng' to File cache in [/var/www/vhosts/toast.lancs.ac.uk/httpdocs/jahans/Wimbrick/lib/Cake/Cache/Cache.php, line 323]
I tried using chmod -R 777 to edit the permissions, but the messages still persisted when I tried ./cake bake again. Then I tried baking my models anyway, I was able to choose which tables I wanted to bake just fine, but when it asked for my primary key it suggested 0 and after this it gave me the usual "does everything look okay?" message as if everything had worked fine, when I hadn't been able to see my fields, set any validation criteria or do anything useful at all.
Does anyone have any clues?
Thanks.
It turned out to be an external problem at work.
You are doing it wrong.
You need to read the docs on how to execute shells in CakePHP.
Always navigate into your APP dir:
cd /path/to/app
Then run it relative from there:
Console/cake bake

Varnish configuration not working

I have been installed varnish module in drupal 7 while clicking on configure it shows an error page with title server error and if i come back to module menu there was another error log
like Warning: require_once(/var/www/magz/sites/all/modules/varnish/varnish.admin.inc): failed to open stream: No such file or directory in menu_execute_active_handler() (line 515 of /var/www/magz/includes/menu.inc).
I tried reinstalling and some other stuffs but the error is still there is there any solution for this
Did you checked if the path and file (folder) is valid? seems that the module requires certain file which are not there.
I've checked with version: 7.x-1.0-beta2 and no such issue occurred.
Just to close out that the read permissions would cause this, please follow the instruction from that: page - regarding access rights setting.

why i see this session errors with cakephp

i was installed cakephp application on godaddy but something wrong i see this errors please anyone help my..the script work correctly but i cant login with users controller
Warning (2): session_start() [function.session-start]: open(/var/chroot/home/content/37/7269737/tmp/sess_5fngsu7g8llj60a9075mkkgh07, O_RDWR) failed: No such file or directory (2) [ROOT/7269737/html/cake/libs/cake_session.php, line 587]
Warning (2): session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/37/7269737/html/cake/libs/debugger.php:683) [ROOT/7269737/html/cake/libs/cake_session.php, line 587]
Warning (2): session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/37/7269737/html/cake/libs/debugger.php:683) [ROOT/7269737/html/cake/libs/cake_session.php, line 587]
Warning (2): Cannot modify header information - headers already sent by (output started at /home/content/37/7269737/html/cake/libs/debugger.php:683) [ROOT/7269737/html/cake/libs/cake_session.php, line 588]
Warning (2): Unknown: open(/var/chroot/home/content/37/7269737/tmp/sess_5fngsu7g8llj60a9075mkkgh07, O_RDWR) failed: No such file or directory (2) [Unknown, line ??]
Warning (2): Unknown: Failed to write session data (files). Please verify that the current setting of session.
You have to do following steps
Set permissions of write to /tmp folder that is default
Change php.ini to point to dir you have access instead of /tmp
Set Configure::write('Session.save', 'cake') and have them in cake
app/tmp where you can manage permissions definitely.
For that you have to changed the Session settings in the config/core.php file. There are several options. The default is to use php.ini settings for to save sessions.
For more details CakePHP Core Configuration Variables
The direct cause of this error is that you are unable to write in the directory /var/chroot/home/content/37/7269737/tmp/.
Either this folder does not exist, create it.
Or it is there, and you need to give it the 0644 permission level.
Hope this helps!

access static file in public_html/tmp without going trough controller in cakephp

I have uploaded my cakephp app to cpanel and adjust and configure it to works with cpanel. Everything mostly works, however i find out that try to retrieve static file from tmp in public_html result in error. It tries to go to controller i think.
My structure is like this :
/cakephp139
/cake
/vendors
/renttycoons <= this is app folder
/public_html
/tmp
/js
....
I tried to access www.domain.com/tmp/test.csv, but result in errors although the test.csv was there. This is the error :
Error: The requested address '/403.shtml' was not found on this server.
Any idea would be appreciated. Thanks
does it gives you cake like error? it seems like a permission error.
erorr 403 is forbidden error, not a not found or something like that. Your server gives you that error and tries to show you a page for that error that is not found so you are receiving a 404 for not having a page for a 403 error hehe.
It must be a permission error, try changing permission to 705 in the temp folder, your test.csv file included. If you are creating it with php, php normally creates them with the minimun permission, at least that happened to me... you may use chmod function in php to change the permissions after creating a file.

Resources