Welcome Guest, Not a member yet? Register   Sign In
Dev App on live server
#1

[eluser]karstyn[/eluser]
Hi All,

New to CodeIgniter and have taken over an existing project. I've been trying unsuccessfully to get an identical development installation on my laptop as the live server has. The live server is on linux and my laptop is XP, although I am using apache on port 8080 and not IIS. I have the same versions of apache and PHP on my laptop as the live server apache 2.0 and PHP 5.1.6, and have tried as much as I can to get the php.ini config file as close to the live version as I can by scanning phpinfo() for the settings. I'm even connecting to the live database for now just to cut down on one more moving piece. If I get the setup working then I can switch to a testing version of the database.

When I try to run the application locally I get a lot of bugs, and weird things like html elements, div tags, showing in form fields, page submissions break, etc.

So actually two questions -

1. Anything obvious I may be overlooking in trying to setup my development environment?

2. If I can't get a development environment to work can I have a second Application folder on the live server that I can use as a development area? I've tried a few things to get this approach to work as well, but no luck either. I've tried changing the index.php 'base_url' to include a 'dev/' sub-directory, with a full copy of CodeIgniter in dev/. Also tried changing the config settings to point the 'system' to 'dev/system' but that didn't work either. Unfortunately this is a hosted application and I don't have system level directory access.

Any ideas greatly appreciated!
#2

[eluser]Ben Edmunds[/eluser]
Check that mod_rewrite is enabled and your .htaccess is setup properly.

You could always setup a sub-domain on your server for testing...
#3

[eluser]rogierb[/eluser]
I had a similar problem, mainly due to short_tags not being enabled locally.
#4

[eluser]karstyn[/eluser]
Ben - I enabled mod_rewrite and that did seem to fix some issues. Now I think the problem is a missing .htaccess file. When I copy the full site to my local computer I don't have an .htaccess file, but I do notice that on the live site the /index.php is not a part of the URL's. If I understand correctly that change happens in the .htaccess file? I have seen a what goes in that file somewhere, but now can't find where I saw it! Any pointers as to what goes in the .htaccess file?

rogierb - I had enabled short_tags earlier, which did get me closer!

Thanks guys!
#5

[eluser]Ben Edmunds[/eluser]
Here is a basic htaccess to get you started:

Code:
DirectoryIndex index.php
RewriteEngine on        
RewriteCond $1 !^(index\.php|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

What this will do is rewrite anything that isn't index.php, forums, images, css, downloads, js, robots.txt, or favicon.ico.
#6

[eluser]karstyn[/eluser]
Excellent!

That will do it - thank you!
#7

[eluser]bretticus[/eluser]
[quote author="karstyn" date="1256326007"]Ben - I enabled mod_rewrite and that did seem to fix some issues. Now I think the problem is a missing .htaccess file. When I copy the full site to my local computer I don't have an .htaccess file, but I do notice that on the live site the /index.php is not a part of the URL's. If I understand correctly that change happens in the .htaccess file? I have seen a what goes in that file somewhere, but now can't find where I saw it! Any pointers as to what goes in the .htaccess file?

rogierb - I had enabled short_tags earlier, which did get me closer!

Thanks guys![/quote]

Keep in mind that the purpose of the .htaccess file in apache is for making apache configuration changes when you do not have administrative access to the apache configuration files. That said, it's very possible that there is no .htaccess file on the live site. The rewrite settings may be part of the apache configuration stowed away where you can't read them. However, most rewrite settings are pretty basic for CI. That is, they rewrite all the URLS to point to index.php. So you should be able to emulate this behavior in your test environment. See the wiki for .htaccess configuration.
#8

[eluser]karstyn[/eluser]
bretticus - thanks, very helpful info on the wiki page.




Theme © iAndrew 2016 - Forum software by © MyBB