1

I do not use "php spark serve" command every time. Is it possible to us that without cmd command? I searched and found something. They are saying that move files from public directory to htdocs and change

$pathsConfig = FCPATH . '../app/Config/Paths.php';

to

$pathsConfig = FCPATH . 'app/Config/Paths.php';

but it does not work. By the way, my main location is htdocs/cms. And I changed base url in App.php like this

    public $baseURL = 'http://localhost:8080/cms/';

and .env like this

app.baseURL = 'http://localhost:8080/cms/'
blackbishop
  • 30,945
  • 11
  • 55
  • 76

2 Answers2

1

Simply set up a virtual host on your local machine.

STEPS

Based on a windows computer & xampp.
Assumes your main project directory is at C:\xampp\htdocs\cms

  1. Edit the file C:\windows\system32\drivers\etc\hosts, add the line below at the end and save. You may need administrative privileges to change this file.
127.0.0.1       local.cms

  1. Edit the file C:\xampp\apache\conf\extra\httpd-vhosts.conf, add the lines below at the end and save.
<VirtualHost *:80>
        ServerAdmin sinan-sankaya@gmail.com
        DocumentRoot "C:\xampp\htdocs\cms\public"
        ServerName local.cms

            <Directory "C:/xampp/htdocs">
                 Options Indexes FollowSymLinks
                 AllowOverride All
                 Order allow,deny
                 Allow from all
                 Require all granted
            </Directory>

</VirtualHost>
  1. Reset your $pathsConfig variable back to the default (C:\xampp\htdocs\cms\public\index.php).
// ...
$pathsConfig = FCPATH . '../app/Config/Paths.php';
// ...
  1. Change your $baseURL configuration. (C:\xampp\htdocs\cms\app\Config\App.php)
// ...
    public $baseURL = "http://local.cms";
// ...
  • If you make use of the .env file, configure that as well.
 app.baseURL = 'http://local.cms'
  1. Restart the Apache webserver. You may start the MySQL service as well if you haven't already and your app uses a database.

enter image description here

  1. Open your favourite web browser and search http://local.cms
steven7mwesigwa
  • 5,701
  • 3
  • 20
  • 34
0

I am a Mac OS user. And I was using Xampp for Codeigniter. Now I tried Mamp, and it works. Thank you for the answers.

ZygD
  • 22,092
  • 39
  • 79
  • 102