I am working on CakePHP, and I have my app working in my localhost. If I try to run my app in another machine, I need to to set the base path.
How to do this? Any suggestions?
You only need to set the path to the cake directory. You can do so in
/path/to/your/app/webroot/index.php
by setting the CAKE_CORE_INCLUDE_PATH
Related
I am getting a problem in deploying my app to the server. The problem is i have folders inside the webroot which points to the .css and .js files.
I was doing the basic cakephp function $this->Html->css('bootstrap') when my simple css files were in the css folder but now there are some other folders inside the webroot because of using the plugins for the frontend UI.
For this i have changed my url to like this $this->Html->css('/global/plugin/file')
Problem is on local it is working fine because of virtual host example.com but on live server i have domain like this 192.168.00.00/mysite so it go to the main directory to and link the ip 192.168.00.00 instead of going to 192.168.00.00/mysite.
Is there any good way to solve this and add the flexibility to the url so that my local and live will not be disturbed while i push my code through git?
Just removes '/' from $this->Html->css('/global/plugin/file') to below
<?php
$this->Html->css('global/plugin/file');
$this->Html->script('global/plugin/file'); //example loading file.js
?>
I already had an issue about this one including my JS and CSS inside a folder but when I removed '/' it solve my problem.
Confirm that their is a file.css inside plugin inside webroot\css\global\plugin\file.css windows path or LINUX path /webroot/css/global/plugin/file.css
I tried upgrading my cakephp version from 1.3 to 2.5 but encountered an url rewriting problem. Another cakephp app runs on the same version so I'm sure the mod_rewrite works.
Although when I go to example.com/pages/home I get following error:
URL rewriting is not properly configured on your server. 1) Help me configure it 2) I don't / can't use URL rewriting
When I go to my normal home page and I want to click on a home link I get following url :
http://example.com/app/webroot/index.php/
And it is the same for other urls.
http://example.com/antwerp becomes http://example.com/app/webroot/index.php/antwerp
When I go to http://example.com/antwerp the site works as it should...
Any ideas where I've gone wrong?
I would suggest accessing your account and re-uploading your .htaccess files from and to the following locations respectivelly.
/app
.htaccess
/webroot
.htaccess
.htaccess
Some FTPs do not upload those files automatically until you force it to.
If that does not work, check if you have your php.ini file in your public_html folder of this application.
I tried to configure cakephp on justhost for my addon domain and i'm getting 404 not found error when I go to www.merryflowers.com/pages/home
Can someone please help me out?
The following are the changes I made in /webroot/index.php and /webroot/test.php
if (!defined('ROOT')) {
define('ROOT', DS.'home'.DS.'xxx'.DS.'public_html');
}
if (!defined('APP_DIR')) {
define('APP_DIR', 'merryflowers');
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', DS.'home'.DS.'xxx');
}
Do I need to make some changes to the .htaccess file? and .htaccess file from which folder?
under public_html/merryflowers.com/ i have:
views, plugins and webroot folder
thank you
It seems mod_rewrite isn't functioning properly, I can access the webrootdirectory (http://www.merryflowers.com/webroot/), which states that core.php can't be found. Before you look into possible mod_rewrite problems, ensure core.php is properly included.
I'm not sure you need to set all the paths in index.php, setting CAKE_CORE_INCLUDE_PATH might be enough.
You're full path isn't DS.'home'.DS.'xxx', but:
DS.'home'.DS.'xxx'.'public_html'.DS.'merryflowers.com'
You might want to set ROOT and APP_DIR to the default values, unless you need custom paths.
How do I set the root of the application?
What I mean, is that when I work locally, everything is under the root of my local website (i.e www.in cake.local/).
Now I made an application that will not be at the root of a website (i.e. www.outsite.com/sciences/biology/here_is_my_app).
Is there a way to make absolute URL in my app point to the app directory and not to the root of the website?
Let's say that www.outside.com is pointing to directory www.outside.com/ on Your hosting.
Putting Your app in www.outside.com/sciences/biology/ directory should do the trick.
You can also use the HTML base tag to achieve this, set it to Route::url('/');
I have been using 1.2.6 and downloaded 1.3 to try it out. I am using wampserver with Apache 2.2.11. I have mod rewrite enabled. When I bake a new application using the cake 1.3 console, after I verify that the webroot/index.php of the application CAKE_CORE_INCLUDE_PATH is set to the Cake1.3 Installation folder. The result is a page thats missing CSS, missing a method. Typing in localhost/app/index.php will enable the program to find the app. Therefore I have to assume the rewrite module isnt functioning properly for v1.3. Is there something I have to add to the cake installation or app folder to make this function as it should?
No, Cake is set up properly from the start. The thing that always trips me up is that I forget to set my Apache virtual host's AllowOverride value to All. This allows the .htaccess file to be read.
Are there any error messages in your apache error logs?
Did you replace the previous application's directory with the new one? If not, you may need to add a tag with the appropriate AllowOverride permissions set inside your httpd.conf file, to allow mod rewrite to execute.
Can you load /css/style.css in your browser or does it give a 404?
This may sound like a silly question, but after you made your changes to AllowOverride in your Apache configuration, did you restart Apache?