Using CakePHP 1.3, I have the following layout:
/srv/www/_cakephp13/
/app/
/cake/
/plugins/
/vendors/
etc...
/srv/www/htdocs/
/cake_app/
/other-dir/
... where htdocs is the public directory, and I have moved webroot of my app to be cake_app above... Which appears to be almost working. (After customizing webroot's index.php).
When I access http://devserver/cake_app/, I am able to see the default "Home" page controller/view (which I have customized, so that appears to be working).
But when I access http://devserver/cake_app/controller/view I am receiving 404 errors.
Is is possible to run a Cake App in a sub-directory of a site root? How can I get this working?
Ideally, I don't want to edit Apache conf's... If I can fix this with Cake configuration or htaccess files, I'll be much happier.
You should verify that .htaccess is being run and that the rewrite module is on and working.
You will need to have mod_rewrite enabled on Apache. To check if it's on, make a page that just does this:
echo phpinfo():
Grep on the text "loaded modules". Make sure mod_rewrite is listed there. If it's not, you can either add it to apache's configuration, or you may need to install it (depending on your original installation method and whether you included that module).
If you can't get mod_rewrite running, you can still use cake without it (the URL will just look like index.php/controller/action/etc). Check out http://book.cakephp.org/view/333/A-Note-on-mod_rewrite for more info. Specifically,
If you don't want or can't get
mod_rewrite (or some other compatible
module) up and running on your server,
you'll need to use Cake's built in
pretty URLs. In /app/config/core.php,
uncomment the line that looks like:
Configure::write('App.baseUrl',
env('SCRIPT_NAME'));
Related
As you can see, it gives me a weird view. I use apache+php5+mysql for my wordpress, and everything seems to work right during installation of Wordpress. But it just gives me such a strange scene.
Has anyone seen similar problem as I do? When could be the reason for this?
Can't say for sure without visiting the site, but it looks like you didn't add index.php to DirectoryIndex in your httpd.conf file (for Apache, or whatever the equivalent is in whichever server you're using)
I am not sure - pic resolution is low but it looks like the directory contents. make sure php is (a) installed (b) enabled on the directory (c) after you make changes to the server config, restart it (d) php files are set to execute php interpreter
I read the docs and installed lithium exactly like they have explained but I keep on getting a 403 forbidden error. I am new to apache and php and I have been spending two full days trying to make lithium work. I am running apache 2.0 on osx lion and here is what I did:
1- I created a new directory called my_app in localhost/~marwan/
2- I extracted the sample lithium app in to that directory.
3- I downloaded the lithium framework and extracted it into /libraries/lithium/
When I access http://localhost/~marwan/my_app/ I get the following 403 error:
You don't have permission to access /~marwan/mj/ on this server.
I have researched and added Options +FollowSymLinks to the .htaccess file and the error changed to:
You don't have permission to access
/Users/marwan/Sites/my_app/app/webroot/webroot/ on this server.
I have tried to add Options +FollowSymLinks to every .htaccess file but nothing changed.
I dont know if this is relevant: websites on localhost/~marwan/ work but localhost also shows a 403 error. I tried to fiddle with different permissions posted in previous answers but with no luck.
Thank you for your help.
httpd.conf file is here http://pastebin.com/jLwHPbuq
Edit:
httpd-userdir.conf is here http://pastebin.com/ZXi51pn7
httpd-vhosts.conf is here http://pastebin.com/3xqRmrzL
Update
The lithium project works when I remove the .htaccess from the main folder but it doesnt work properly because rewriting doesnt work. Here is the .htacces in the project root http://pastebin.com/vt0fVyyL
The path you provide in the error message /~marwan/mj/ and the path you provide that you are trying to reach http://localhost/~marwan/my_app/ do not match. According to the error the web server says you are trying to access a directory called mj while your url does not include mj so unless you are doing some URL rewriting this looks like an issue.
Also, just to be clear, when you say you installed the library in /libraries/litium you mean relative to the web root path, correct?
OK, looking at your conf files you can serve files out of /Library/WebServer/Documents or out of ~/Sites (that tilde represents your user directory so it is the same path as /Users/marwan/Sites)
Do this...
In /Library/WebServer/Documents place a file called index.html and have it output some text.
Make sure there are no .htaccess files in /Library/WebServer/Documents.
Make sure you have not modified your httpd.conf file in any way from its default settings.
Do you see the correct behavior for your index.html (you should)? If not, what happens?
I looked at the error log after restarting apache and found DocumentRoot [/usr/docs/dummy-host.example.com] does not exist so I fixed it by using this answer stackoverflow.com/questions/6671042/… and now it works.
I created a project and a controller called about.
But I dont know how to navigate from the controller to my webpage...
Even when I write the url, the website doesnt appear :(
http://localhost/dev.gamenomad.com/About
default url structure http://host/controller/action, I'm familiar with this book so assuming everything is properly setup try http://localhost/dev.gamenomad.com/about/contact the url you're calling will by default load the indexAction and I don't think you have one yet.
Also in your netbeans right click on your project name, then at the bottom of the menu select properties, then in the left pane select 'Run Configuration'. Now make sure your Project url is correct and if you have specified an Index file make sure it points to public/Index.php (usually when using Zend Framework I don't specify an Index file)
Now if you still have issues go through the checklist:
mod_rewrite enabled in httpd.conf (or in .htaccess)
vhost setup and enabled if using one
make sure there is an .htaccess in your /public folder (put there by Zend_Tool when building app).
you're not using Internet Explorer (This browser give strange behavior, especially for newbies)
enable development mode or changed all the 0 in your application.ini to 1
All I want to do is be able to see a PHP file from the root without it going through the rewrites (thus our custom CMS).
Here's what I've done:
In my httpd.conf, I've commented out the call to load the mod_rewrite module.
Next, I've removed the .htaccess file from the root as it had the rewrite rules in it.
I've rebooted the server.
I've searched through phpinfo() and there are no "rewrite" strings to be found
The problem is that the server still rewrites and the request passes through our CMS.
I'm using XAMP (PHP 3.3.1, Apache 2.2.14)
What am I missing?
maybe cache problem in your browser? because a similar thing happened to me and deleting the cache solved it.
Leave it to the details... I was trying to access my_file.php on the root. However, the filename was actually my-file.php (dash vs underscore).
The page I was getting was a 404, which went through the CMS. When I access the proper file, the one with the dash, I get what I'm supposed to.
I appologize for the waste of time :)
Good day. I have a problem with links in my application. I want to use 'pretty-urls',so i want to all my links look like 'www.sitename.com/controller/method'. So i want to print my all my links through one function,which would look like
function link($url_segments) {
if(mod_rewrite_is_available)
return BASE_URL.$url_segments;
else
return BASE_URL."index.php".$url_segments;
}
But i can't understand how to detect if server has rewrite module enabled. I have found 2 solutions:
Place in config some variable(like codeigniter does) like
$config["index_variable"] to use inside my function,but that means
that all my clients will need to change that line in config when
installing application on hosting
Use function to detect mod_rewrite,like apache_get_modules,but like
i understood it can be not avaibale on some hosting,and what if
server will be nginx?
So i want to know,how to detect that and print my links.
Thanks everyone for help.
Can you just provide the .htaccess to your clients so that, when you upload the files, it turns the rewrite mod on?
This can be very tricky and hard, personally, I would go with the fallback approach.
Look at apache2handler's loaded modules (via phpinfo()) to see if mod_rewrite is there
Try sudo apache2ctl -t -D DUMP_MODULES to see if mod_rewrite is loaded
Try to use a .htaccess file to see if everything is working.
Try to determine the server software used, and parse the conf file for the server
Use worst case of no mod_rewrite is enabled, and then enable it manually after the software has been installed.