3

I have a website running with CakePHP. Now I need to include a Wordpress blog to run along with it. The issue is that I need to make some integration, like user logins, so I'm trying to include the Wordpress file that's supposed to give that integration.

My server's file system structure is:

/root
    /app (cake's app directory)
        /webroot
        /...
    /blog (wordpress directory)
        /wp-admin
        /...

The installation for Wordpress went fine (I'm using a subdomain that points to this folder), so now I have both sites running perfectly by themselves.

However, as I mentioned above, I need to create some integration with them, specifically log in users in the Wordpress site when they log into my CakePHP site. I've tried doing what this other question says, but I get the following error:

Fatal error: Cannot redeclare __() (previously declared in /homepages/36/d******/htdocs/cake/basics.php:657) in /homepages/36/d********/htdocs/app/controllers/users_controller.php on line 60 

I'm trying to place the code that should bring Wordpress' functions into CakePHP (require('../../blog/wp-blog-header.php');) in the users_controller, but I'm not even sure that's the right place to do that.

I've read somewhere else that sometimes different frameworks declare functions with the same name and that can cause conflict.

So I'm not sure if that's the case or I'm just placing the "integration code" in the wrong place.

Any help would be much appreciated!

1
  • Did you get anywhere with this? I'm in the position you were in when this was posted - about to try and integrate WP with an existing CakePHP app. Any advice would be helpful, as the web has almost no good info on how to do it.
    – Derek
    May 15, 2013 at 15:20

2 Answers 2

1

You will save yourself a lot of hassle (especially when it comes to future upgrades) if you can modify your design to have 2 separate domains, and a framework in each. By doing it this way, the most complicated bit will be to implement some kind of SSO between the two...but it should be easier than trying to merge 2 frameworks (that operate completely differently).

0

If you want to manage multi domain login then you could only do that with Single Sign On method. You could also use CAS Server for managing that functionality as well as Auth.

I am just give you small information related to CAS.

In which, you must have to install CAS server. And there is PHP client available.

After successfully installation of CAS server, you must have to setup your cas server application as home page of your whole application.

So if you come first at your application, it will directly check the session on your cas server. If you are not logged in then it will ask login form and your php client will manage login session for your application.

After successfully login, you could get the details of user id and based on that, you could compare your cakephp application database and wordpress database.

If the id is found then you just have to login otherwise it will redirect to CAS server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.