• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set the "document root" to the public folder inside your project

#1
HI, first sorry my english, it's not the best. I am new in CI 4, although I have experience en CI 3. MY problem is quite comented in other post.
I copied the CI 4 code in my web server , the same directory when I have a project with CI 3. The name of the folder that contains the CI 4 code es CI4, so http://localhost/CI4 should be the way to access to the welcome message. But the CI return
"If you see this message, you have not configured your web server properly.
You need to set your "document root" to the code public folder inside your project. This could be your default setting, or that of a virtual host, depending on how you set up your local development environment.".
I set
Code:
public $baseURL = 'http://localhost/CI4/public';

in application/config/app.php.
In other post I read set it to
Code:
'http://localhost/CI4

only but the problems persits in both case.
What the problem? What can I do?
Thanks
Reply

#2
Setting your document root refers to web server configuration, eg setting the DocumentRoot inside Apache or your virtual host setting. If Apache's document root is "/projectroot/public", then your $baseURL will be "http://localhost" or the virtual host domain that you have setup.

If you need "public" inside your baseURL or as part of the location field inside your browser, then you haven't setup the server properly.

See https://bcit-ci.github.io/CodeIgniter4/c...tml#public
Reply

#3
If you don't want to muck around with your web server settings, you can use the built-in PHP server but dropping to the command line and running:

Code:
> php serve.php

This will start up the local server which you can access at http://localhost:8080, and will handle basic URL rewriting so that things behave as you would expect them to under Apache or nginx.
Practical CodeIgniter 3  • CodeIgniter 4 Foundations - Coming Soon • Vulcan - CLI Tools for CI4
Reply

#4
Thanks for yours answers.
ciadmin: I created a virtual host. so I can access  my application through http://code
I changed the name of the folder to code instead of CI4.
But returns the error message ( see image)

I downloaded twice the code from official website of Codeigniter 4 an the error is the same.
what can I do?
thanks again.


Attached Files Thumbnail(s)
   
Reply

#5
I use phpStorm and I also have to add a mapping in phpStorm to my public_html folder after that everything works fine.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

#6
If in system/CodeIgniter.php , I delete line 38
Code:
use Config\Services;

the problem disappears( returns the welcome message), but I dont' know why and its consequences.
Reply

#7
Edel what type of server setup are you using locally and what OS are you running on? There's another report at GitHub about this happening on a WAMP setup. I know we're not seeing that on Mac or Linux, though.
Practical CodeIgniter 3  • CodeIgniter 4 Foundations - Coming Soon • Vulcan - CLI Tools for CI4
Reply

#8
kilishan I am using wamp server version 3.0.6, which use php 7.0.10 and apache 2.4.23.  My OS is Windows 7 64 bits.
Reply

#9
@killshen, If I remember right I read someplace that people were running the 32-bit version of wamp because they were having problems with the 64-bit version.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

#10
(07-14-2017, 10:41 AM)Edel Wrote: If in system/CodeIgniter.php , I delete line 38
Code:
use Config\Services;

the problem disappears( returns the welcome message), but I dont' know why and its consequences.

I run Linux and have successfully installed CodeIgniter several times.

I found the installation instructions slightly confusing because Ubuntu Apache2 does not have a /public/ folder. Instead it has a /public_html/ folder where index.php should be copied and modified. The modifications are to set the paths to the Application and System folders.

The index.php can be tested by echo __FILE__; die; at the top of the index.php file. This should display the full path when http://localhost/ is called from the browser command line.

I copy the Application folder above the Root (where the index.php file resides) and the System folder into an even higher, common, CI2 folder (could even be on another drive). This makes it easily available to other CodeIgniter installations on the same drive. The System folder contents should never be altered.

The identical structure can be uploaded to the server and does not require any changes apart from the .htaccess file for pretty URLs, file type optimisatiion, caching, etc.
CI4 - Playground:
    https://www.john-betong.tk/test/1/42
CI 3.15  -  AmpProject 
     http://tools.pingdom.com/fpt/#!/uC1KU/ww...-jokes.com

Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.