Enabling CiviCRM php scripts under Perusio's drupal configuration

Torenware's picture

I'm now running a Drupal / CiviCRM site on AWS using Perusio's standard config. This mostly works fine.

The one issue I've found is that CiviMail uses a variety of PHP scripts located under sites/all/modules/civicrm/extern/ (e.g., sites/all/modules/civicrm/extern/soap.php, sites/all/modules/civicrm/extern/open.php, etc.). Short version: the CiviMail back-end needs to talk to the installed CiviCRM instance via these end points. Since the standard Perusio config only wants to talk to /index.php, I need to extend things for this specific group of scripts.

What's the cleanest/recommended way of adding this functionality?


Check out, for example,

Garrett Albright's picture

Check out, for example, apps/drupal/drupal_install.conf to see how Perusio's config makes an exception for install.php if you include that .conf file. It basically boils down to:

location = /path/to/a/php-file.php {
    fastcgi_pass phpcgi;

Put something like that in the server {} block(s) of the relevant conf file in sites-enabled. That should do it.

I missed that but I stumbled on something similar

Torenware's picture

Thanks. that looks like it would work.

I had found something from drupal.org/project/octopus. "Octopus", which works with Aegir, has a bit like this:

### Allow some known php files (like serve.php in the ad module).
location ~* ^/sites/./(?:modules|libraries)/(?:ad|tinybrowser|f?ckeditor|tinymce|wysiwyg_spellcheck|ecc|civicrm)/..php$ {
  access_log   off;
  try_files    $uri =404;
  fastcgi_pass; ### php-fpm listening on port 9000

I put this into my private version of drupal.conf just above the catch all location that emulates .htaccess on Apache, and changed fastcgi_pass to phpcgi, as you do above. Since we use some of the modules in that list, it made sense to do it that way.

It does appear to work, at least.