CakePHP install on local pc (xampp) incorrect paths - cakephp

I have script built with an old version of CakePHP.The script works just fine on live servers but when i tried to install it on my pc (with XAMPP installed) igot problems...I have this error:
Warning: include(cake\bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\hack\index.php on line 76
Warning: include(): Failed opening 'cake\bootstrap.php' for inclusion (include_path='\C:\xampp\htdocs\hack\cakecore;\C:\xampp\htdocs\hack\cakeapp\;.;C:\xampp\php\PEAR') in C:\xampp\htdocs\hack\index.php on line 76
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 C:\xampp\htdocs\hack\index.php on line 77
I'm pretty sure that this error is triggered by incorrect paths in index.php file,because if i made wrong path in index on the live website got exactly the same erorr.The problem is that i have no idea how to fix that paths.
My site files are located in: C:\xampp\htdocs\mysite
So here is how i made the paths on index.php file:
/**
* The full path to the directory which holds "app", WITHOUT a trailing DS.
*
*/
if (!defined('ROOT')) {
define('ROOT', DS.'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite');
}
/**
* The actual directory name for the "app".
*
*/
if (!defined('APP_DIR')) {
define('APP_DIR', 'cakeapp');
}
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
*/
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', DS.'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite'.DS.'cakecore');
}
Can you tell me what I missing?I have spent 2 days on this and can't find a solution.

You're defining CAKE_CORE_INCLUDE_PATH as DS.'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite'.DS.'cakecore' which in windows will translate to a wrong path of \C:\xampp\htdocs\mysite\cakecore. Notice it starts with \ when it should be C:\....
So make it 'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite'.DS.'cakecore' or 'C:\xampp\htdocs\mysite\cakecore' as there isn't any advantagle in using DS if you place C: in the path, it will work only in windows after all.

Related

SWUpdate on RPi4 via yocto - error parsing configuration file

After booting SWUpdate yocto-generated image for the first time, executing swupdate results in error message:
Error parsing configuration file: 'globals' section missing, exiting.
I tried to strictly follow SWUpdate's documentation, but it gets short when it comes to yocto integration. I'm using meta-swupdate, meta-swupdate-boards, and meta-openembedded layers together with poky example repository all at Kirkstone tag, building via bitbake update-image and having modyfied local.conf as:
MACHINE ??= "raspberrypi4-64"
ENABLE_UART = "1"
RPI_USE_U_BOOT = "1"
IMAGE_FSTYPES = "wic ext4.gz"
PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv"
IMAGE_INSTALL:append = " swupdate"
Is there anything else I need to modify to generate the configuration file and be able to run SWUpdate binary properly?
Side question: In the documentation, it's recommended to append swupdate-www to achieve a better web server. However, if I append it, there is no swupdate-www binary inside the `/usr/bin' directory.
As with other recipes folders the recipes-support/swupdate/swupdate/raspberrypi4-64 folder was missing inside the meta-swupdate-boards layer. Therefore, an empty config file was always generated. After adding this folder and all related files, strongly inspired by raspberrypi3 folder, the error was gone and swupdate -h provided the expected output.
There was also one new error during build process thrown by yocto. It was related to missing systemd requirement and was solved by adding:
DISTRO_FEATURES_append = " systemd"
to local.conf

c programming: program reads 'Desktop' folder as 'DEsktop' with capital E

So the C program i am building has to be placed within the PA_mobile file on the desktop of my MAC computer (OS X 10.9.4) so it can access the scripts and text file caches that are associated with it.
now when my program launches, it validates the current working directory, comparing it to a string variable which contains the correct working directory, and requests a working directory change if the program is not located in the desktop.
here is the code associated with the directory path validation:
char* cwd_2;
char buff[PATH_MAX + 1];
cwd_2 = getcwd( buff, PATH_MAX + 1 );
char desired_working_directory[50] = "/Users/haydn/Desktop/PA_mobile";
if( cwd_2 != NULL )
{
printf("\n-----------------------------------");
printf("\nCurrent working directory: [%s]\n", cwd_2 );
usleep(10000);
printf("Desired working directory: [%s]\n",desired_working_directory);
usleep(50000);
if(strcmp(desired_working_directory, cwd_2) == 0)
{
fflush(stdout);
printf("Appropriate Working Directory achieved!\n");
printf("-----------------------------------");
}
else
{
printf("Critical Error: inapropriate working directory!\n");
printf("please relocate the 'PA_mobile' file to [/users/user/Desktop] and re-launch\n");
getchar();
exit();
}
}
The program compares the current working directory path as determined by the cwd_2 variable and compares it to the desired working directory path as described in the desired_working_directory variable.
Now here is what the program displays when run:
-----------------------------------
Current working directory: [/users/haydn/DEsktop/PA_mobile]
Desired working directory: [/Users/haydn/Desktop/PA_mobile]
Critical Error: inapropriate working directory!
please relocate file to [/users/haydn/Desktop] and re-launch
Notice that the current working directory displayed (which is determined by the getcwd( buff, PATH_MAX + 1 ); function describes the desktop file as DEsktop instead of Desktop as it is meant to be. i have checked the actual desktop folder, it is spelt without a capital E, and the capital E appears to be causing the problem, and exists solely within this code, can anyone help me?
If you run diskutil list / (or diskutil info / on latter variants of Mac OSX) you'll see whether the file system is case sensitive or not. You may need to do it on a file system lower in the hierarchy than / if those directories are in a separate file system.
You could also try the following sequence of commands:
touch /Users/haydn/Desktop/xyzzy
touch /Users/haydn/Desktop/xyzzY
ls /Users/haydn/Desktop/xyzz*
and see how many files are there. One means case-insensitive, two means case sensitive.
It's the file system personality that dictates this and, unless it mentions case sensitivity, you can assume it's not.
In which case, there is no distinction between these:
/users/haydn/DEsktop/PA_mobile
/Users/haydn/Desktop/PA_mobile
^ ^
despite the differing letters.
If you've established that this is the problem, your code should really be adjusted to handle both cases. This question (and its answers) offer ways to do this from within your code.

Mailchimp with cakephp

I am download sample code from mailchimp site and copy paste in my c:/xampp folder now i am run the index.php file but i got following warning and error
Warning:
include(C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master/Vendor/pear-pear.cakephp.org/CakePHP\Cake\bootstrap.php):
failed to open stream: No such file or directory in
C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master\webroot\index.php
on line 107
Warning: include(): Failed opening
'C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master/Vendor/pear-pear.cakephp.org/CakePHP\Cake\bootstrap.php'
for inclusion (include_path='.;C:\xampp\php\PEAR') in
C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master\webroot\index.php
on line 107
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
C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master\webroot\index.php
on line 114
Now I am install composer and create phar file and try to update with composer update command but following error display
http://prntscr.com/5d2cgw
In composer.json file change require property with this lines
"require": {
"cakephp/cakephp": "2.5.*",
"mailchimp/mailchimp": ">=2.0.0"
},

Could not load main class in JavaCC

I am AI student and we work with JavaCC.
I am new with it. I was trying simple example and I had some errors.
1) I downloaded JavaCC 0.6 from it's website
2) I extracted it in disc C
3) I wrote this code in a file with extension ".jj"
PARSE_BEGIN(Test)
import java.io.*;
class Test
{
public static void main(string [] args)
{
new Test(new InputStreamReader(System.in));
start();
}
}
PARSE_END(Test);
Token:
{
<number: (["0"-"9"])+("." (["0"-"9"])+)?(("e"|"E")(["0"-"9"])+)?>|
<plus: "+">
}
void start():
{ }
{
<number>(<plus><number>)*
}
4) I saved it and put it in javacc/bin folder
5) I wrote this line in command
..."my Path"..javacc Test.jj
6) I had this error
Could not find or load main class javacc
Is there something I have to install before these steps?
thx in advance
Use version 5 at https://java.net/projects/javacc/downloads . Version 6.0 is missing the scripts to run JavaCC. If you really want to use version 6.0 you can find the appropriate scripts in version 5, just copy them to version 6's bin directory and away you go.
Update (2020): Since version 6 is now harder to find, I have put a copy at www.engr.mun.ca/~theo/JavaCC/javacc-6.1.0.zip
I selected the step you missed in bold below.
The download should have placed into your file system either a ZIP or
GZIP file containing the JavaCC software. You should go to the directory
where the archive was installed and unzip it's contents. That
completes your installation.
Once you have completed installation, add the bin directory within
the JavaCC installation to your path. The javacc, jjtree, and jjdoc
invocation scripts/executables reside in this directory.
You need to modify PATH system variable in windows (wild guess on used OS).
For example as described in
http://www.computerhope.com/issues/ch000549.htm
http://www.java.com/en/download/help/path.xml
...

CakePHP 1.2 application with non-regular Cake path throwing errors

I'm having trouble with a CakePHP website. I've dropped my app directory into a staging folder so it's a duplicate of the live site. So the structure looks like this:
app
config
...
webroot
cake
config
...
tests
docs
staging
app
config
...
webroot
vendors
vendors
I've set the CAKE_CORE_INCLUDE_PATH constant in /staging/app/webroot/index.php to the root directory where my cake folder is, and set my database settings in /staging/app/config/database.php.
Now, although the site at http://domain.com/staging/ seems to be working, I'm getting the following errors at the top of my page:
Warning (2): mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 117]
Warning (2): mysql_select_db(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 122]
Warning (2): mysql_get_server_info(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 130]
Warning (2): mysql_real_escape_string() expects parameter 2 to be resource, boolean given [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 247]
Warning (2): mysql_query(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 152]
Warning (2): mysql_errno(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 329]
Warning (2): session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /users/ia/www.cantifix.co.uk/cake/basics.php:111) [CORE/cake/libs/session.php, line 535]
Warning (2): Cannot modify header information - headers already sent by (output started at /users/ia/www.cantifix.co.uk/cake/basics.php:111) [CORE/cake/libs/session.php, line 536]
What's going on? My database connection settings seem to be correct as like aforementioned, the site works as it should (except for these error messages).
If any one has any tips or pointers for multiple apps using a single cake library, I'd be most grateful.
i used dozens of those "app" folders in the same dir.
it all works perfectly without any configuration overhead
why are you changing your CAKE_CORE_INCLUDE_PATH?
leave it as it was.
also leave ROOT as dynamic default:
define('ROOT', dirname(dirname(dirname(__FILE__))));
cake will take care of everything itself.
also note:
you should set your VirtualHost down to webroot. example setup:
http://www.dereuromark.de/2011/05/29/working-with-domains-locally/
then there should be no problem.
I too have many projects in Cakephp and all I needed to do was to clone app/ and rename it. I did not need to change cake_core_include_path. All I needed was to setup another vhost to point to the new directory's webroot.
Maybe you copied a lock file?
Warning (2): mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2) [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 117]
This seem to be the error that is triggering all the rest of the errors. The rest of the mysql errors were expecting resource but got a false boolean. The header errors are due to the error outputs most likely
Fixed! Turns out it was a problem with my database.php configuration file. I copied the values from my $staging array to the $default array and cleared the tmp folder, and balance was restored in the universe.

Resources