Apache problem? |
[eluser]luisfmgoncalves[/eluser]
Hello, I've been developing an application in my Windows box (localhost) and now I'm trying to put the application in a Linux server. And of course, I'm having problems... When I started to develop in windows, I did some configurations to make things work, but in the end was all ok. I used XAMPP. Now something is wrong and I think is something to do with Apache configuration. I followed this steps: http://codeigniter.com/wiki/mod_rewrite/ to take off the index.php and I can open the application. But when I try to do something on it, simple don't work... When I do: Code: a2enmod and then Code: rewrite I got the message: 'Module rewrite already enabled', which is good... If I do: Code: apache2ctl -l I got: Code: Compiled in modules: Which of this is the mod_rewrite? Oh, and by the way, the file mod_rewrite.so shouldn't be present in /etc/lib/apache2/modules? Because it's not there! Any of you can help me?
[eluser]n0xie[/eluser]
Code: apache2ctl -l Try: Code: apache2ctl -t -D DUMP_MODULES
[eluser]luisfmgoncalves[/eluser]
Hello, and thanks for your reply. I can see that mod_rewrite is active: Code: rewrite_module (shared) But I'm experience something strange and I'm not sure if is because of the .htaccess file. For example, when I enter my application, I have this in my main page: Code: <a href="main/login"><div style="margin: 10px"><?php echo snappy_image('twitter_button_3_hi.gif', '', ''); ?></div></a> So, this is just a call to the controller main and to the function login I changed the login function code, just for tests and now I have just this: Code: function login(){ So, this is just a call to a view that contains the following code: Code: <html> So, just a pretty basic html page. And when I press the link, the browser goes to: Code: http://somedomain.co.uk/project/main/login And this is correct. But, the problem is, when I press the link, the application just open an empty (blank) page! Any of know what could be the problem? My .htaccess file is like this: Code: <IfModule mod_rewrite.c> (My project is in /var/www/project) I'm using: Code: $config['uri_protocol'] = "PATH_INFO"; Because I'm using this library. This is the .htaccess file I use in my Windows box, and everything is working good and the httpd.conf file in my Apache (with XAMPP) is like: Code: <Directory "C:/Program Files/XAMPP/htdocs"> In the Linux box I have (in /etc/apache2/sites-enabled/000-default): Code: <Directory /var/www/> So, they are the same... Just one more note: I'm using twitter, as you can see. To do this I had to create a twitter application with a URL callback. The thing is, this url is like: Code: http://somedomain.co.uk/project/main/login But I'm running the application localhost, so I added the following lines to my hosts file: Code: 127.0.0.1 somedomain.co.uk I have the same thing working in the Windows box. Apache log: Code: Mon Jun 14 10:26:48 2010] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function view() in /var/www/project/system/application/controllers/main.php on line 28, referer: http://somedomain.co.uk/project/index.php You know what is going on? Thanks, Luis Gonçalves
[eluser]n0xie[/eluser]
Code: Mon Jun 14 10:26:48 2010] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function view()
[eluser]luisfmgoncalves[/eluser]
Hey man, thanks again. I figured out what is the problem, but looking for a way to solve it. Basically I have a desktop computer with windows and a laptop with ubuntu Linux. In both the application is running ok, but when I move the application to the main server (with Linux too) the application have a strange behavior. And that happens because I'm using Haughins library to get info from twitter and this info comes in json format. In my both computers I get a json response, but in the server, I get the full page (html) as response, and this makes the application with that behavior. This means that the server donw access to my index.php file? Actually I did this in my application: http://codeigniter.com/wiki/mod_rewrite/ Any suggestions?
[eluser]luisfmgoncalves[/eluser]
Hello again, I spent the last 5 days trying to make this shit work, and till now nothing... This is the first time such thing happen to me and I'm really desperate... When I put the files in the server, and after configure all the paths, the application runs. But when I try to do something, nothing works, cause instead of json I'm getting html and I don't know why. And, as I told you before, in my laptop (with linux) and in my desktop (with windows) everything is ok. One example I have is like: Code: <input type="submit" value="" class="search" id="search" name="search" /> and I'm doing some stuff in jquery: Code: (document).ready(function(){ If I press the button I get the window with 'test', so this means that jquery and my .js file are being loaded (as firebug say). But if I have the code: Code: (document).ready(function(){ I'm just trying to call the function search inside home controller. Im my controller I have just: Code: function search(){ But this is never executed. In Firebug I can see that I'm having a response, but is not what should and the response is in HTML and should be in JSON... None of you know wtf is going one? I kinds new to CI and I'm tired to try things and till now nothing... Please help, Thanks Luis
[eluser]danmontgomery[/eluser]
It's possible that the "home/search" path is being seen as relative to the current url... I would try changing it to an absolute path to see if the code executes
[eluser]luisfmgoncalves[/eluser]
Hello and thanks for your reply... I tried that already and the result is exactly the same. I went to folder system/application/controllers, I did a pwd and I got: Code: /home/user/domains/somedomain.co.uk/public_html/system/application/controllers and in the .js file I changed the code to: Code: (document).ready(function(){ But the result is exactly the same. Any other suggestions? Luis
[eluser]danmontgomery[/eluser]
Well, the fact that you're getting exactly the same result with the relative path and an obviously invalid path like the server path just confirms what I was thinking, the problem is an invalid path. Use the absolute web path, eg. /home/search, or http://www.somedomain.co.uk/home/search There is a $ before the (document) in your jquery, right?
[eluser]luisfmgoncalves[/eluser]
Hey again, and thanks for your reply. I was so desperate that what I did was starting to just copy and past the code to the server and see where will fail, and now I know what is wrong. The problem is with this line: Code: $config['uri_protocol'] = "AUTO"; The thing is, to use the Elliot Haughin twitter API, I had to change: Code: $config['uri_protocol'] = "AUTO"; to Code: $config['uri_protocol'] = "PATH_INFO"; And when I do that, the application stops working. So, I suppose this is because some misconfiguration (or something missed) in the apache server, right? Can I change my .htaccess to make this work? Thanks, Luis Gonçalves |
Welcome Guest, Not a member yet? Register Sign In |