CodeIgniter Forums
CI in a Linux environment setup - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: CI in a Linux environment setup (/showthread.php?tid=62212)

Pages: 1 2 3


RE: CI in a Linux environment setup - John_Betong - 10-23-2019

Try changing the following line in the .htaccess file:

# RewriteBase /20190916Bibliotecas/

Does the Welcome_message page show OK?


RE: CI in a Linux environment setup - esle - 10-23-2019

(10-23-2019, 08:32 AM)John_Betong Wrote: Try changing the following line in the .htaccess file:

# RewriteBase /20190916Bibliotecas/

Does the Welcome_message page show OK?
I just added that line due to the solution proposed on stackoverflow but my original file didnt containt it.

This is my original .htaccess code
Code:
RewriteEngine On
RewriteCond $1 !^(index.php|styles|scripts|images|jQueryUI|fonts|uploads|media|robots.txt)
RewriteRule ^(.*)$ /20190916Bibliotecas/index.php/$1 [L]


If you mean by welcome message the message xampp  shows up when I connect to localhost yes it is working. if it's not that message then I cannot access any webpage inside my project. Could you please  check if its working on your end? so we can then check if its problem of my linux distro...

Edit: changing
Code:
$route['default_controller'] = 'Home/index'; // to
$route['default_controller'] = 'welcome'; // shows the same 404 error page not found


Thanks


RE: CI in a Linux environment setup - John_Betong - 10-23-2019

Try this .htaccess script which is extracted straight from the standard installation and notice the difference in your script:



# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

>>>

The welcome message I mentioned is from the standard installation which I test to ensure the basics work without errors before adding my own pages:


https://ci4-strict.tk/welcome-strict


RE: CI in a Linux environment setup - esle - 10-24-2019

I have tried your solution with no success. this is de code of my currently .htaccess
Code:
#RewriteEngine On
#RewriteCond $1 !^(index.php|styles|scripts|images|jQueryUI|fonts|uploads|media|robots.txt)
#RewriteRule ^(.*)$ /20190916Bibliotecas/index.php/$1 [L]1
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

I have tried the solution with and without the first line and nothing
Code:
RewriteEngine On

I don't see the welcome message because this is copy of folder straight from CI version 3.x.x I was going to try a migration  to 4.x but it seems it won't be that simply of copying and paste my controllers, views, jQuery,etc.

I'm gonna try to install xampp on a new virtual machine with Linux maybe Ubuntu just to check if its thing of my distro or CI, and try to load my project https://we.tl/t-me9F2Obn7g  from there.

Could it be that CI is not recognizing properly my URLs?, permissions on htdocs are set to owner myself.


RE: CI in a Linux environment setup - John_Betong - 10-24-2019

I tried the .htaccess file on CI_3.1.10 and it worked OK.

I notices that the Routes file has the following and no doubt accounts for why the Splash page is not appearing.

$route['default_controller'] = 'Home/index'; // to
$route['default_controller'] = 'welcome'; // shows the same 404 error page not found

Please try remming the second redirection because it overrides the original redirection to the Home controller.

And don't forget to use the following .htaccess script:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

That should render the Splash page and I find it is far better to start with something (Hello world) and add script until failure occurs. It is a nightmare starting with something that does not work.

Once working experiment with different debug options.


RE: CI in a Linux environment setup - esle - 10-24-2019

(10-24-2019, 08:27 AM)John_Betong Wrote: I tried the .htaccess file on CI_3.1.10 and it worked OK.

I notices that the Routes file has the following and no doubt accounts for why the Splash page is not appearing.

$route['default_controller'] = 'Home/index'; // to
$route['default_controller'] = 'welcome'; // shows the same 404 error page not found

Please try remming the second redirection because it overrides the original redirection to the Home controller.

And don't forget to use the following .htaccess script:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

That should render the Splash page and I find it is far better to start with something (Hello world) and add script until failure occurs. It is a nightmare starting with something that does not work.

Once working experiment with different debug options.

Sorry if I confused you with  but didn't mean to
Code:
$route['default_controller'] = 'Home/index'; // to
$route['default_controller'] = 'welcome'; // shows the same 404 error page not found
But my routes only contain one line, I was referring to that I have already tried setting it up to 'welcome' and nothing, right now tried setting 'welcome' and the .htaccess you provide me and still nothing.

EDIT: So I have set up some old projects I had withing htdocs folder containing only, HTML, CSS, Bootstrap and some jQuery and they're rendering ok, seems it's problem within CI.


RE: CI in a Linux environment setup - John_Betong - 10-25-2019

>>> But my routes only contain one line, I was referring to that I have already tried setting it up to 'welcome' and nothing, right now tried setting 'welcome' and the .htaccess you provide me and still nothing.

Nothing??? Did you check the error logs?

>>> EDIT: So I have set up some old projects I had withing htdocs folder containing only, HTML, CSS, Bootstrap and some jQuery and they're rendering ok, seems it's problem within CI.

OK - in the project that is not working, please point the system directory to the old projects that are working OK and try and get the Welcome_message to display.


RE: CI in a Linux environment setup - esle - 10-25-2019

(10-25-2019, 02:18 AM)John_Betong Wrote: >>> But my routes only contain one line, I was referring to that I have already tried setting it up to 'welcome' and nothing, right now tried setting 'welcome' and the .htaccess you provide me and still nothing.

Nothing??? Did you check the error logs?

>>> EDIT: So I have set up some old projects I had withing htdocs folder containing only, HTML, CSS, Bootstrap and some jQuery and they're rendering ok, seems it's problem within CI.

OK - in the project that is not working, please point the system directory to the old projects that are working OK and try and get the Welcome_message to display.

From application/logs
Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>

DEBUG - 25-10-2019 12:00:58 --> UTF-8 Support Enabled
DEBUG - 25-10-2019 12:00:58 --> Global POST, GET and COOKIE data sanitized
ERROR - 25-10-2019 12:00:58 --> 404 Page Not Found: /index

OK - in the project that is not working, please point the system directory to the old projects that are working OK and try and get the Welcome_message to display.

Could you elaborate on that? in my project/system directory there are few folders I don't know where to specify what you say.

Thanks


RE: CI in a Linux environment setup - John_Betong - 10-25-2019

>>> Could you elaborate on that? in my project/system directory there are few folders I don't know where to specify what you say.

index.php -> $system_path = 'system';


I have $system set to: 
   $system = '/var/www/ci2/CodeIgniter-3.1.11/system';

I also have the previous version:  
  $system = '/var/www/ci2/CodeIgniter-3.1.10/system';

This is because it is easier to share one version between other projects.


RE: CI in a Linux environment setup - esle - 10-25-2019

Ok I found my $system_path inside my index.php and editing it to the options you gave prompts me an error in browser:

Code:
Notice:  Undefined variable: system_path in /opt/lampp/htdocs/20190916Bibliotecas/index.php on line 200

[b]Warning[/b]: 
require_once(/opt/lampp/htdocs/20190916Bibliotecas/core/CodeIgniter.php):
failed to open stream: No such file or directory in [b]/opt/lampp/htdocs/20190916Bibliotecas/index.php[/b] on line [b]316[/b]

[b]Fatal error[/b]:  require_once(): Failed opening required
'/opt/lampp/htdocs/20190916Bibliotecas/core/CodeIgniter.php'
(include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/20190916Bibliotecas/index.php on line 316

Investigating futher there's no /www/ci2/CodeIgniter-3.1.11/system folders inside my var folder. there's not even /www