Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Monday, February 24, 2014

CakePHP - multiple projects on one Apache and CakePHP core

CakePHP - get multiple projects working on apache.
If you want to run two cakephp projects on one instance of Cake core, and apache, here is some useful info:

Edit - /etc/apache2/extra/httpd-vhosts.conf 
Add the following:

    ServerAdmin webmaster@one.local
    DocumentRoot "/Users/d/Documents/project/one/webroot/"
    ServerName one.local
    ServerAlias www.one.local
    ErrorLog "/private/var/log/apache2/one-error_log"
    CustomLog "/private/var/log/apache2/one-access_log" common

   
      Order allow,deny
      Allow from all
      #Options +Indexes
      Options -Indexes +FollowSymLinks
      AllowOverride All
   

    ServerAdmin webmaster@app.local
    DocumentRoot "/Users/d/Documents/project/app/webroot/"
    ServerName app.local
    ServerAlias www.app.local
    ErrorLog "/private/var/log/apache2/app.com-error_log"
    CustomLog "/private/var/log/apache2/app.com-access_log" common

   
      Order allow,deny
      Allow from all
      #Options +Indexes
      Options -Indexes +FollowSymLinks
      AllowOverride All
   



Now you have the two apps at:
http://one.local/
http://app.local/


Saturday, June 23, 2012

Installing Graphite


I faced all these issues while installing graphite, but I am assuming other apps will have similar issues.

First error that I could not find easy answer for:
[FATAL] Unable to import the ‘cairo’ module, do you have pycairo installed for python 2.6.6?

Solution:
yum install pycairo python-devel

Next error:
[FATAL] Failed to create text with cairo, this probably means cairo cant find any fonts. Install some system fonts and try again

Solution:
yum install bitmap-fonts-compat

--------------------------------
Next when I did /etc/init.d/httpd reload, I got wsgi error

To fix that, step 1:
Make sure you have aspx installed.
If not:
yum install httpd-devel


Now, install mod wsgi
# Install mod_wsgi
mkdir temp/
cd temp/
wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
tar fxz mod_wsgi-3.3.tar.gz
cd mod_wsgi-3.3/
./configure
make
make install
cd ../../
rm -rf temp/


Now: you can do
/etc/init.d/httpd reload

Friday, May 7, 2010

stop php deprecated warnings in browser

I just installed newest version of wamp server on a new windows 7 machine. When I installed the web app, I got a bunch of following printouts in the browser at the top of every webpage:
Deprecated: Assigning the return value of new by reference is deprecated in [...]\cake\libs\inflector.php on line xxx

After spending an hour looking, here is what worked:

1. in cake/lib/object.php: add following in next line after <&ques;php
error_reporting(E_ALL ^ E_DEPRECATED);


2. in cake/libs/configure.php replace
error_reporting(E_ALL);
with
error_reporting(E_ALL ^ E_DEPRECATED);


3. in your php.ini, search for error_reporting and replace the entire line with
error_reporting = E_ALL & ~E_DEPRECATED

Thursday, January 28, 2010

160043 "Could not open the requested SVN filesystem"

After about a year since we set up subversion server, I needed to create a new project. So I ran
>svnadmin create myproject
We have svn hooked with apache - that is, https protocol.
When I tested the new url in a browser, I got the following error:
160043 "Could not open the requested SVN filesystem"

I found a lot of posts on the web that discussed this error message, but none suggested a solution other than upgrading svn and apache builds.
Since existing projects were working fine, I didn't see the need to upset my stable environment.

When I looked at apache logs, I saw the message:
Expected FS format between '1' and '3'; found format '4'

So that give me the hint - what search results for error 160043 were saying was correct, the version of apache's svn mod and svn server doesn't match. What they didn't tell me (or I missed the search result that did mention it) was that the easier fix is to create the project as follows:
>svnadmin create myproject --pre-1.5-compatible

This solved the problem for me.

Wednesday, January 14, 2009

Ignoring svn entries in Cakephp

If you are trying to protect the svn related files so that they dont get shown in a browser, here is what worked for me after trying various things:

RewriteRule ^(.*/)*\.svn/(.*) - [F,L]

Making Cakephp and Shindig work together

So we decided to use Shindig for our web console widgets. There is lot of documentation on how to make shindig work as a virtualhost.

However, I didnt find complete documentation on how to make it work as a Alias (say www.domain.com/shindig/xxxx)
Where your Cakephp app runs at www.domain.com/

So basically, we have cakephp running as virtual host and our gadgets/widgets will be provided by shindig using the url www.domain.com/shindig/gadgets/ifr

Just few days ago, I read an interesting point in a performance article on Android code site - (paraphrasing) there are two phases of learning to developing on a new platform - first step is to make it work, second step is to make it work the right way.

So here is what I did and made it work - now you readers tell me how to make it work the right way.

I did svn co of Shindig in my downloads directory.
From there, I exported the following directories into vendors/shindig directory of my cake app.
- config
- features
- javascript
- php

So far so good.

In shindig/php/.htaccess file have the following line uncommented:
RewriteRule (.*) /shindig/index.php [L]

In shindig/php/config/container.php update as follows:
'web_prefix' => '/shindig',
'default_js_prefix' => '/shindig/gadgets/js/',
'default_iframe_prefix' => '/shindig/gadgets/ifr?',


In shidig/config/container.js, change all occurences of %host% with %host%/shindig. When I did it, there were 5 instances.

Now the shindig side is updated.

Next we need to tell Cakephp to ignore shindig urls. So, in your root .htaccess file
add
RewriteRule ^shindig/.*$ - [L]
Getting this to work took me a good part of the day. But hey, I now know how mod rewrite works, which I never bothered to learn till now.


Last part, we need to update the apache virtual host, so I added the following block:

Alias /shindig /dev/coolproduct/vendors/shindig/php
<Directory /dev/coolproduct/vendors/shindig/php>
</Directory>



Now, I put in a sample container and a widget, which I can load using:
http://local.domain.com/shindig/gadgets/files/coolappsamplecontainer/coolappsamplecontainer.html

Friday, December 12, 2008

shindig and ssl

For our website, we are looking at some gadget/widget frameworks. First thing I tried was shindig from apache.

I had some trouble getting it to work, so I thought I will document the workaround, in case someone else has the same problem.
Note that in the end, the problem turned out to be different versions of openssl in apache and php, but here is how to work around it.

What caused the problem?
I like portable apps. So that whenever I change/upgrade my machine, I just copy my 'dev' directory to new machine, and my whole development environment is avaialble out of box.
I had set up apache and php about 2 years ago. Over time, as I played with various apps, lot of fat was added, not all of which jive together (notably openssl in this context).


So, to try out shindig, I downloaded the package and followed instructions from this site:
http://incubator.apache.org/shindig/#php

I turned on curl and openssl in php.ini, by uncommenting extensions for curl and openssl.

I configured virtal domain shindig.com and then I hit this url in a browser:
http://shindig.com/shindig/php/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml

I got this error message:
Shindig requires the openssl extention, see http://www.php.net/openssl for more info

Without SSL, I got the above message, but with SSL, apache showed alert with this message whenever I tried to start apache.
"The ordinal 3879 could not be located in the dynamic link library LIBEAY32.dll"


I tried various things, but then I didn't really need ssl at this point, so here is what I did. I went into the shindig code, and found that I could work around the problem. Here is how:

In shindig/php/index.php
look for openssl, and change it like this:

//$modules = array('json', 'SimpleXML', 'libxml', 'curl', 'openssl');
$modules = array('json', 'SimpleXML', 'libxml', 'curl');

That's it. When I will need ssl, I will handle that, but for now, I can keep playing with shindig.