Inside this article we will see the concept i.e How to start development server into a different port other than the default port of bin/cake built in server.
In cakephp 4, when we start the development server or say built in server. It starts application at 8765 the default given port of application. Now, in this classified information of article you will learn how to change this port and assign a user defined port to start development server.
Learn More –
- CakePHP 4 Error: Database driver Cake\Database\Driver\Sqlite cannot be used
- CakePHP 4 CRUD Using Ajax Requests Tutorial
- Authentication Tutorial in CakePHP 4
- Working with CakePHP 4 Cron Jobs
Let’s get started.
CakePHP 4 Installation
To create a CakePHP project, run this command into your shell or terminal. Make sure composer should be installed in your system.
composer create-project --prefer-dist cakephp/app:~4.0 mycakephp
Above command will creates a project with the name called mycakephp.
Open project into terminal and type the command –
$ bin/cake server
It will start development server at 8765 port, like http://localhost:8765
Now, let’s see what are the options available to use this bin/cake command.
Help Manual – server
$ bin/cake server --help
Inside this, we have options as –port or -p which is for setting port to run application. We will use it to change default port.
Using –port flag,
$ bin/cake server --port 8085
Using -p flag,
$ bin/cake server -p 8085
Application will start http://localhost:8085 port.
We hope this article helped you to learn about CakePHP 4 – Change Default PORT of Development Server in a very detailed way.
Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.