CakePHP 1.3.0 RC4 Installation - cakephp

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?

Related

Apache and Yeoman built NodeJS app on the Same Server... Virtual Hosts?

I've been trying to add a NodeJS app (built by Yeoman - angular-fullstack generator) on my apache server.
I've found this other answered question : Apache and Node.js on the Same Server
suggesting to use ProxyPass like this :
ProxyPass /node http://localhost:8000/
The problem I encounter when I do that is that my app starts on an index.html wich includes some files with href.
Since these hrefs doesn't start like this
href="/node/..."
They aren't redirected by Proxypass, and thus result in a 404 error.
I can't just change all the hrefs : that would mean I need to do it all over again on my 3 environment : development, production and test, and even if I did that, everytime I'll use Grunt to test my app, it automatically rebuild my index.html anyway. (Besides, it doesn't solve everything, there are some problems with socketio appearing when I do that)
Only thing I can do then is using ProxyPass like this :
ProxyPass / http://localhost:8000/
There it does works, absolutely no problem, just like if I actually was using the app on from my server on localhost.
The only remaining problem is that I need to have 2 environments on my server, on for production and on for tests, and I just can't do
ProxyPass / http://localhost:8000/
ProxyPass / http://localhost:8001/
It obviously won't work since everything will be redirected to port 8000 bvefore anything can reach the second line.
So, I'm left with only two options :
Either find another solution than using "/" as criterion for redirecting to localhost:8000 that would work in the same manner (and I didn't find anything working)
Or use virtual hosts... And there goes another problem : I'm really not confortable with network issues, from what I understood, to have several virtual hosts on the same machine, I need several CNAMES (one for each virtual hosts), but I don't know how to list / add CNAMES (my server runs on Windows Server 2008 with no access to the world wide web), and I don't have any "DNS" application in my "Administrative Tools" as I'm supposed to according to this : https://technet.microsoft.com/en-gb/library/cc753579.aspx
Any help would be very welcome
Thanks in advance !
EDIT : I really think that my solution is to twitch my Apache configuration. Can anyone used to deal with server configs help me? :/
Seems like all I was missing was a
<base href="/node/">
tag (didn't even know about it, and Yeoman created it as )
I still have a problem though :
Socket.io ... I don't really get my own problem here : it's in node_modules (wich is normal since I need it in my server and my client), but trying to include it as I was doing so before using base href fails.
I don't even get how it did work before : (index.html : )
<script src="socket.io-client/socket.io.js"></script>
This doesn't seem right knowing my project folder is like this :
[PROJECT ROOT]
-client
--index.html
-node_modules
--socket.io-client
---socket.io.js

Debug CakePhp Step by step

My client want the code I've did in a subfolder.
I've put everything inside but I have only a blank page.
When I try to use phpinfo in the index file, nothing appears.
On the app/core.php the same
I don't have access to root to test if it's an issue with the root .htaccess or with my script.
Which cakephp file should be called first if the subdomain setup is good?
Thanks.
EDIT:
Ok I know what's wrong. SetEnv PHP_VER 5_3 does not work on the shared
hosting where my client have his main website. The client does not
want to upgrade the php version and this directive in the .htaccess
seems to be ignored. What alternatives do I have ...?

CakePHP without mod_rewrite causes 404 errors

I'm pretty new to Cake, so I tryed to start with the blog tutorial.
I installed CakePHP 2.3.8 in webroot.
Configured SQL and deleted all 3 .htaccess-files, cause i have no mod_rewrite. In core.php I activated
Configure::write('App.baseUrl', env('SCRIPT_NAME'));
I created the Posts-Model, Controller and the index-View like the tutorial says.
The APP/View/Pages/home.ctp tells me, everything's allright.
But when i try to open /posts/index i get a 404. Why?
Without mod_rewrite the urls look like www.example.com/index.php/controllername/actionname/param, i.e. in your example you have to call /index.php/posts/index (or /index.php/posts/).

URL rewriting is not properly configured on your server

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.

Cakephp 2.1 White Screen on Devserver

We created a subdomain on our server. First we tested that HTML worked, then I did phpinfo() and everything worked fine there. But when I moved the entire Cakephp app to the devserver at:
dev.lessonshark.com
I get a white screen. But I can go to:
dev.lessonshark.com/css/front.css
and that routes fine.
What I have done so far:
1. Made debug in core set to 3.
2. Removed all the cache files in tmp folder.
Still no luck, any ideas?
Firstly, check your server error logs. White screens are usually one of the following:
You didn't clear out the files in /app/tmp/cache (leave the
directories, remove any files).
You are running out of memory (check the server logs)
mod_rewrite is not enabled on the server or is not configured correctly (check you have allowOverride all set in your apache config so Cake's .htaccess files are read)
[edit]
you haven't made your app/tmp directory writable by the web user
I just cracked my head with this problem.
If none of the above mentioned solution work, (debug, emptying cache..etc), try this one.
Open up your controller, remove any unwanted empty line especially at the top of the file anywhere around you <?php tag, and make sure no useless empty line around the closing ?> tag as well.
I hope it help.

Resources