Get A Fresh Install of WAMP Server 2.0 and CodeIgniter 1.7.1 Running

0
122

If you’re running a fresh install of WAMP and CodeIgniter like myself you are already probably running into problems such as deprecation errors and then a URI issue here’s some help:First, here’s how to solve the issue regarding these errors:

Deprecated: Assigning the return value of new by reference is deprecated in C:wampwwwcisystemcodeigniterCommon.php on line 130

Deprecated: Assigning the return value of new by reference is deprecated in C:wampwwwcisystemcodeigniterCommon.php on line 136

In index.php in your CI folder replace line 12 “error_reporting(E_ALL);” (without quotes) with this:
error_reporting(E_ALL & ~E_DEPRECATED);” (without quotes)

Then, you’ll probably get an error about a bad URI if you try to run any controlls. It should say something like this: “The URI you submitted has disallowed characters.”

Here’s the solution for that as well. In URI.php which is located in systemlibraries replace line 189:

if ( ! preg_match("|^[".preg_quote($this->config->item
('permitted_uri_chars'))."]+$|i", $str))
” (without quotes and without the line break (it’s all one line)

to read like this:

if ( ! preg_match("|^[".str_replace('-', '-', preg_quote ($this->config->item('permitted_uri_chars')))."]+$|i", $str))” again without the quotes.

Also, please note that wordpress is changing the ” marks into pretty quotes WHICH WILL NOT WORK if you do a copy/paste. So, either retype the code by hand or when you do copy/paste go back and replace the pretty curly quotes with regular quote marks. Thanks go to  Bram Van der Sype in the comments who caught this problem!

This should help you save a couple of hours of frustration. The reason for the change is in PHP 5.3 preg_quote was changed to escape the dash, so character ranges won’t work.

1 COMMENT

  1. I was wondering why it wasn't working after upgrading WAMP, however I did everything you said and now I get this errorParse error: parse error in C:WampwwwoneosurcefxsystemlibrariesURI.php on line 189

  2. I would double check to make sure that you changed 189 to look just likethis:if ( ! preg_match(“|^[“.str_replace('-', '-', preg_quote($this->config->item('permitted_uri_chars'))).”]+$|i”, $str))Jason

  3. Yea there were none its ok now, I'm unsure why it wouldn't work for me however I just downgraded the php version from 5.3.0 to 5.2.9, as my real hosting isn't even at 5.2.9 yet and I don't think they plan on changing it anytime soon. So no worries I will have a crack at it again later.Thanks for your quick reply!

  4. That seems to be where the trouble is lying. it's the upgrade to php 5.3that's been causing the issues. I believe the latest trunk of CodeIgniterhas fixes for it but I'm not 100% positive on that.Jason

  5. This works like a charm! Do note that you can't copy your code literally as your blog software changes ” ” into pretty characters. You have to retype them to normal ” instead of accents.

  6. Your problem probably is the fact that the ” ” signs are changed into pretty accents, which won't work. So don't copy it literally!

  7. Nevermind on the last post. I was trying to load the sample website in Derek Allard tutorial page.. http://video.derekallard.com/.. evidently the codeigniter version is not current so the notes given above on uri.php modification do not apply. FYI for all trying this. Will try to modify to get it to work. That is, install new codeigniter with stated changes adding website specific data afterwards.. hope it works.

  8. Deprecated: Assigning the return value of new by reference is deprecated in D:wampwwwnew-projmythribazarsystemcodeigniterCommon.php on line 129Deprecated: Assigning the return value of new by reference is deprecated in D:wampwwwnew-projmythribazarsystemcodeigniterCommon.php on line 135A PHP Error was encounteredSeverity: 8192Message: Function set_magic_quotes_runtime() is deprecatedFilename: codeigniter/CodeIgniter.phpLine Number: 60A PHP Error was encounteredSeverity: 8192Message: Assigning the return value of new by reference is deprecatedFilename: libraries/Loader.phpLine Number: 255A PHP Error was encounteredSeverity: 8192Message: Assigning the return value of new by reference is deprecatedFilename: database/DB.phpLine Number: 133