0

I'm taking over a codeigniter project that was originally developed in MAMP on OSX.

My php dev environment is a XAMPP on Windows. Works great for all my other work and projects. However I copied this app I took over to my htdocs folder and it works but it causes lots of problems with rewriting URLS (for example ModRewrite isn't working when it is suppose to, see ModRewrite not working for codeigniter site).

Could these problems stem from the two dev environments? It works fine when on my host, but I need to make changes.

EDIT: Got it back on a MAMP environment, same exact problem. Looking into config now.

Community
  • 1
  • 1
ItsPronounced
  • 5,475
  • 13
  • 47
  • 86
  • Do you use the same configuration in both environments (except paths)? – Gumbo Jan 15 '11 at 18:59
  • I really don't think so :( I know the paths are different though – ItsPronounced Jan 15 '11 at 19:00
  • 1
    @drpcken: Then try that first. Try to use the same configuration (well, except the mentioned paths). – Gumbo Jan 15 '11 at 19:35
  • Do i just get the httpd.conf file? What other configuration files will I need? – ItsPronounced Jan 15 '11 at 19:44
  • btw: I think xampp times are over, have a look at Zend Server CE. – markus Jan 15 '11 at 20:25
  • 2
    You should focuss more on the fact that you are moving from an OSX environment to a Windows environment, I think this is what is causing most of your problems, rather than the differences between XAMPP and MAMP. – Naatan Jan 15 '11 at 21:03
  • The reason I like xampp is because I have it setup as a portable environment with dropbox. Would this be possible with Zend Server? – ItsPronounced Jan 16 '11 at 02:11
  • @Naatan I'm only putting it in xampp for development. I do have a mac but prefer my windows pc for dev. I'll put it on my mac with mamp and see if it runs right away without problems. Thanks you – ItsPronounced Jan 16 '11 at 04:33
  • @naatan @drpcken I don't think this would be the issue because most dev environments (*AMP) are ran as virtual servers anyway. – jondavidjohn Jan 18 '11 at 00:06
  • @jondavidjohn I can tell from experience that mod_rewrite quite definitely does show some different characteristics based on OS. – Naatan Jan 18 '11 at 00:24

2 Answers2

2

ok, CodeIgniter specifc environment config issues...

system/application/config/config.php
system/application/config/database.php
./index.php

Things to check are 'base_url' in config.php

Also on this note, make sure in the code the previous author consistently used <?= base_url() ?> for loading assets(css,img,etc..) and other path dependant things.

example url to include a css file <= base_url() ?>css/cssfile.css would create the url http://your.local.host/css/cssfile.css

and <?= site_url('controller/function') ?> would create http://your.local.host/index.php/controller/function

make sure for anchor tags they used <?= site_url('uri/path') ?> for the href.

jondavidjohn
  • 61,812
  • 21
  • 118
  • 158
  • Here is the base_url : `$config['base_url'] = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://'.$_SERVER['HTTP_HOST'].str_replace('//','/',dirname($_SERVER['PHP_SELF']).'/');` – ItsPronounced Jan 22 '11 at 07:09
  • ok, I would scrap that and replace it with whatever virtualhost you have set up for local dev, ex. `$config['base_url'] = 'http://dev.local';` where dev.local is whatever you have setup as the siteroot. – jondavidjohn Jan 22 '11 at 07:17
  • That was it thank you! My initial page works but links don't because it is requiring me to put `base_url/index.php/products` – ItsPronounced Jan 22 '11 at 07:30
  • Ok, make sure you review the documentation and more specifically for links, make sure you re-read my original answer, specifcally about `base_url()` AND `site_url()` – jondavidjohn Jan 22 '11 at 14:24
  • well for the links they used base_url, which is weird because it seems to generate the index.php when rendered. Here's an example of an tag: `Link`. This produced the url http://localhost/Site/products/id/12. This link doesn't work until I type `index.php` after the Site/ segment. This is what I'm trying to remove – ItsPronounced Jan 22 '11 at 15:54
  • ok, so instead of the example href you gave, use this `= site_url('products/id/12') ?>` – jondavidjohn Jan 22 '11 at 16:56
1

1 Check how sitepath is, eg. it was locahost/~user/ci and is localhost/ci

2 if is different Change both config.php and .htaccess

3 make sure that htaccess works. CHeck if module is there and check if allow .htaccess on httpd.conf

See what is different from Mamp to Xampp.

flakerimi
  • 2,580
  • 3
  • 29
  • 49