shelly
By:
shelly

LAMP Stack: getting two folders to communicate with each other

February 12, 2015 2.5k views

Hi there,

I'm having a sort of connection issue with my LAMP setup (Ubuntu 14.04). I've set everything up to accept wildcard domains, which is working great. Currently, I have two folders in my system:

/var/www/html - which holds my WordPress installation (and the main URL - mysite.com)

/var/www/pancake - which olds my Pancake App installation (and the url is pancake.mysite.com as a subdomain)

Both work very well independently of each other - no problems there. My issue is that I'm trying to get my WP install to communicate with my Pancake install. (I'm currently writing a WordPress plugin to allow a user to submit a contact form on my WordPress site, and the information is passed to Pancake and is inserted into the separate Pancake database - sort of like a CRM, for lack of a better description.) If I place the Pancake installation within the WP install, it works just fine (although I lose my subdomain abilities on that point - the location becomes mysite.com/pancake) and the communication works great. But I would really prefer the two items remain in their own separate folders, independent of each other.

I'm guessing there's something in my server setup that is not allowing the two directories to "talk" to each other because they are not in the same public parent, and they are each their own individual public areas, but I'm not 100% sure what I should be looking for to allow the two directories to freely have nice discussions between themselves. I don't know if it needs some sort of .htaccess edit, or user:group permissions or what.

Anyone have any ideas for me?

11 comments
  • symlinks might work:

    sudo ln -s /var/www/pancake /var/www/html
    

    would give you a symlink for your pancake directory as /var/www/html/pancake

    Pancake will see itself as /var/www/pancake, while Wordpress will see it as /var/www/html/pancake

  • How are you passing this information? Via a javascript ajax call? Via http post, some other method? With a bit more information it should be possible to get this working.

  • Sorry - http post using cURL, via a Gravity Form submission. it's connecting with the Pancake API to pass the information.

  • And thank you, sierracircle - I'll see if that works.

  • Sadly, no - the symlink didn't work. It was a good idea though!

  • is there settings where you are putting in the url for pancake? or are you pointing to a file in pancake?

  • Yes, the plugin I'm writing requires two settings: the location of the pancake installation (the URL for the httpbuildquery within cURL), and the API key that's generated within Pancake to tell it the connection has permission to do what needs to be done. All of the connection settings (and information) is being passed 100% perfectly fine and being accepted. However, Pancake has a method for building URLs that technically don't exist (REST API) - so the URL that you connect with is (for one example) mysite.com/api/1/client/new - but that filesystem actually doesn't really exist.

    When I place the pancake installation within the html directory (at the same level as my wp-config.php file) it works just fine, no problems. It's just I have the pancake folder outside the WP install, and I'm pretty sure that's causing the hiccup.

  • just brainstorming:
    I wonder if you should just have your pancake tables in the same database as wordpress and then just send your info directly to the proper tables straight from Wordpress rather than making the journey through Pancake.

    Once the tables are in the same DB you can just use $wpdb to mess with those tables. I did a little contacts database on one project using that method (so contacts could be added via wordpress to my own tables)

  • That's an interesting idea... I'm gonna see what happens :)

  • Well, that kinda worked. I mean, it did, but it caused a few issues (I won't go all into it - just a bunch of warning/error messages that would require me to rewrite a few things that I don't really want to. I'm lazy LOL)

    I ended up just putting the pancake directory in the WordPress directory. Needed to make a couple of tweaks to my .htaccess file, but it's working brilliantly now.

    Thanks so much to all of your for your ideas and help! I really appreciate it :)

  • Sometimes the quick and simple are the best solutions

Be the first one to answer this question.