CI is outputting the code from MY_model class and then saying it can't find it |
[eluser]php_princess[/eluser]
I used CodeIgniter on a remote server, for a live site, for several months. I'm now trying to get the site to run on my computer so I can use my computer as a testing server. So far I can't get it working. When I go to the index page, I get the following output. Take note of the fatal error at the bottom. Code: <?
[eluser]TheFuzzy0ne[/eluser]
Sorry, I don't understand. Is the model code being output as well? It's pretty common to run into compatibility issues between *nix and Windows-based servers. However, these are normally to do with case-insensitivity. Since Windows is case-insensitive, it usually means that what works on Windows, doesn't work on Linux, not the other way round. So I'm not sure if this has anything to do with case-sensitivity. I would suggest you look into virtualisation if you can. Then you can run a virtual machine that runs the same (or similar) OS to your production server. www.vagrantup.com is a good place to start, but there can be a steep learning curve, but it's well worth it. It might work if you change: Code: class MY_model extends CI_model { to: Code: class MY_Model extends CI_Model { It may not fix the issue, but adhering to convention can certainly help fix these kinds of problems.
[eluser]php_princess[/eluser]
Actually, when I load the page in the browser it shows me this: Code: value { if (!is_array($info)) return FALSE; $col_string = ''; $val_string = ''; //make the strings that go in table name parenthesis and value parenthesis $counter = 0; foreach ($info as $column => $value) { $col_string .= '`'.$column.'`'; $val_string .= $this->db->escape($value); $counter++; //This puts a comma after the comma or value, unless it's the last comma/value. if ($counter != count($info)) { $col_string .= ', '; $val_string .= ', '; } } //print "({$col_string}) VALUES ({$val_string})"; die; $query = $this->db->query("INSERT INTO `trash_can` (".$col_string.") VALUES (".$val_string.")"); return ($this->db->affected_rows() > 0) ? TRUE : FALSE; } protected function delete($id, $params) //params is an array { } } ?> but when I view I tell my browser to view the source, I get that code that I pasted in my first post. It starts with the code for My_Model and then shows the fatal error. OH! And it's saying MY_Model now because I changed that, like you asked me to. And yes the remote server is Linux and yes my local computer is Windows.
[eluser]TheFuzzy0ne[/eluser]
Please ensure you have error reporting set to report all errors. There may be other non-fatal errors responsible, which aren't being output. In index.php: Code: <?php Are you able to include the file manually? Code: include APPPATH . 'core/MY_Model' . EXT
[eluser]TheFuzzy0ne[/eluser]
Sorry, I actually thought this was another post, and I'm trying to help with a problem you don't actually have, although enabling error reporting will most likely help. I think that short tags aren't supported either by your version of PHP or your configuration. I think changing <? to <?php will sort your problem. It's also recommended to omit the closing PHP tag to prevent output problems due to trailing whitespace. Instead, it's a good idea to put a comment at the end of the file, so you can be sure it hasn't been truncated. Code: // End of file MY_Model.php
[eluser]php_princess[/eluser]
Wow, I didn't even notice it was <? and not <?php I changed it to the right one and the error went away. Now the site is loading (kind of) and I'm going to poke at it see if I can get it to load the rest of the way. |
Welcome Guest, Not a member yet? Register Sign In |