CakePHP can not find webroot/css/js files - cakephp

I just download via svn controle version a CakePHP 2.5.2 app to a test server .
After database configuration, the app does not open the css files located at app/webroot dir (bootstrap, jquery, main.css).
Is the some aditional config parameter ?
I try changing the owner but did not work.

It looks like a mod_rewrite problem.
Make sure you have .htaccess in your DocumentRoot, and your Apache server is configured properly.
Everything is described in detail in the CookBook.
CakePHP 2.x URL Rewriting
Edit: As described in the comments, it was solved by the OP by replacing the Directory definition in the apache vhost configuration file (/etc/apache2/sites-available/default.conf) with the following:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo
Order Allow,Deny
Allow from all
</Directory>

Related

Create laravel configuration file apache web server

to delete the public folder from my url I have seen that I have to edit the apache configuration file, but since I also have projects that are not developed with laravel I saw that there is the possibility to create a custom configuration file. Where should I put this file?
You could set up a virtual host to serve as your laravel project like below.
Just edit your Apache's httpd-vhosts.conf file and add something like:
<VirtualHost *:80>
ServerName project-laravel
DocumentRoot "YOURPATH/apache2/htdocs/project-laravel/public"
<Directory "YOURPATH/apache2/htdocs/project-laravel/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Also you would have to edit your hosts file and add a line
127.0.0.1 project-laravel
Then, restart Apache and enter the project-laravel into your browser bar.

unable to create alias in apache

I'm new to Apache. Following a tutorial, I am trying to set an alias in Apache to look and serve files from a folder (project). Other than htdocs, this was my code to create alias:
<IfModule alias_module>
Alias /project/ "C:/project/"
Alias /project "C:/project"
</IfModule>
<Directory "C:/project">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
This doesn't work and when I type localhost/project/ in browser, the browser throws access forbidden.
How do I work around it?
You'll have to change your security settings on C:\xampp\apache\conf\httpd.conf
The directory diretive must be on this file or it will always show the forbidden error.

Cakephp 2.0 starts complaining about mod_rewrite

I run Cakephp 2.0 on Ubuntu 10.04, Mysql, Apache2, PHP5, hosted at linode.com. Just two days ago, when clicking on the link from my homepage www.cross-town-traffic-software.com to freecite, I get the mod_rewrite message from Cakephp. Sometimes I don't. I have check all of my logs and nothing comes up. I checked the sites-available and all of the .htaccess files and they are all inorder, how do I trouble shoot?
sudo a2enmod rewrite
sudo gedit /etc/apache2/sites-enabled/000-default
Check for these lines and change as I have done here :
DocumentRoot /var/www/
Options FollowSymLinks
AllowOverride all
Options FollowSymLinks
AllowOverride all
Order allow,deny
allow from all
Save the file & restart apache :
sudo /etc/init.d/apache2 restart
It's pretty simple! cake.generic.css contains the following:
/** Elements **/
#url-rewriting-warning {
display:none;
}
So when you remove that file #url-rewriting-warning will be displayed.
Cheers,
Fredrik

cakephp - one framework, a few apps on localhost subdomain

How to prepare CakePHP framework to work for many apps in one CakePHP framework?
I want prepare structure folders like this:
app1/
app2/
app3/
cake/
vendors/
plugins/
index.php
I would like using http://app1.localhost/ do running app from app1/ folder?
It's possible?
Basically all you need to do is configure the app/webroot/index.php file of every individual app correctly to point to the correct ROOT/cake folder. The rest is Apache virtual host configuration to point the subdomains to the right app folder.
I'm running XAMPP but I'm assuming you're running something similar on your machine. Anyway, go into your apache\conf folder and open up the httpd.conf file. XAMPP has a file called apache\conf\extra\httpd-vhosts.conf that is better for adding Virtual Hosts.
So you'd want to enter the appropriate directives like so...
<VirtualHost *:80>
ServerAdmin postmaster#localhost
DocumentRoot "C:/path-to-your-app-webroot-folder-no-trailing-slash"
ServerName app.localhost
##ServerAlias www.dummy-host.localhost
ErrorLog "logs/app.localhost-error.log"
CustomLog "logs/app.localhost-access.log" combined
<Directory "C:/path-to-your-app-webroot-folder-no-trailing-slash">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Furthermore, if you're on Windows XP, you'll want to make an entry in your C:\Windows\system32\drivers\etc\hosts file of 127.0.0.1 app.localhost to resolve the sub-domain. That should get the job done.

How to install cakephp on localhost?

I wanna to know how to install cakephp on localhost?
Please explain me.
I usually make an apache and mysql installation on a linuxbox. I can use windows too, however I do not recommend it ;)
So, I usually make a new entry into the /etc/hosts file to make a sitename available to cakephp.
127.0.0.1 localhost caketest.local
next step to copy all cakephp files into a subdirectory inside /home/myusername/public_html/caketest
app
cake
index.php
plugins
README
vendors
.htaccess
then I set up the site to apache (not neccessary),
<VirtualHost *:80>
DocumentRoot "/home/myusername/public_html/caketest"
ServerName caketest.local
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/home/myusername/public_html/caketest">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
restart apache. you also need to edit the .htaccess files and place a RewriteBase directive with hte path to the actual directory, e.g.
RewriteBase /~myusername/caketest
create a database, set the db connection in cake config files and that's all.
you can point your browser to http://caketest.local
if you do not want a test site url you can skip hosts, and apache vhost creation, but the url to use should be http:/localhost/~myusername/caketest
another important thing is to enable userdir modul in apache, and also check if using php is enabled in userdirs too.
If you're on windows, get WAMP. Install it, then download CakePHP in C:\wamp\www\. Extract CakePHP in that folder so you have a folder kind of like this: C:\wamp\www\cakephp\. Now you can access the installation by going to localhost/cakephp/.
An old article of mine but still quite relevant:
Installing CakePHP
Assuming you have a *AMP setup (Apache+MySQL+PHP), just copy the files to your htdocs folder. On Ubuntu, it's /var/www, so you would create /var/www/myApp and copy the whole Cake structure into there, ending up with something like:
/var/www/myApp/app/
/var/www/myApp/cake/
/var/www/myApp/vendors/
/var/www/myApp/index.php
/var/www/myApp/.htaccess
Then you can access your app by the url: http://localhost/myApp

Resources