Welcome Guest, Not a member yet? Register   Sign In
Can't access my website through localhost
#1

Good morning!
I'm trying to work on a new website with a colleague of mine using CodeIgniter4, but we found some issues.
My colleague, who deployed the basis of the website recently, uses MacOS and accesses the website through MAMP. No problems on his side.
I use Windows 10 and I access the website with the 'php spark serve' command (but I still use MAMP to access the DB).
As I try to access localhost:8080, PowerShell displays the following error message:


Code:
PHP 8.1.0 Development Server (http://localhost:8080) started
[::1]:55740 Accepted
PHP Warning:  require_once(path-to-project-folder\index.php): Failed to open stream: No such file or directory in path-to-project-folder\vendor\codeigniter4\framework\system\Commands\Server\rewrite.php on line 47
PHP Fatal error:  Uncaught Error: Failed opening required 'path-to-project-folder\index.php' (include_path='.;C:\php\pear') in path-to-project-folder\vendor\codeigniter4\framework\system\Commands\Server\rewrite.php:47
Stack trace:
#0 {main}
  thrown in path-to-project-folder\vendor\codeigniter4\framework\system\Commands\Server\rewrite.php on line 47
[::1]:55740 Closing

Line 47 of rewrite.php is what follows:
Code:
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'index.php';


Our obvious conclusion is that DOCUMENT_ROOT includes the 'public' folder (where index.php is indeed located) in his machine, but it's not included in my machine!


What we setup so far:
App.php
Code:
public string $baseURL = 'http://localhost:8080/';


.env
Code:
app.baseURL = 'http://localhost:8080/'


MAMP/bin/apache/conf/extra/httpd-vhosts.conf

Code:
<VirtualHost *:80>
DocumentRoot "path-to-project-folder\public"
ServerName  localhost
ErrorLog    "logs/myproject-error_log"
CustomLog    "logs/myproject-access_log" common

<Directory "path-to-project-folder\public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>


And finally, our desperation maneuver, on an .htaccess file we created on the root of the project

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

<FilesMatch "^.">
Require all denied
Satisfy All
</FilesMatch>


We also tried to check for potential problems on my machine by making a test website following the CodeIgniter4 guide, but no problems there!
What could it be? We are striving for answers!
Until then, we thank you all in advance!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB