CakePHP 4 – Change Default PORT of Development Server

Reading Time: 3 minutes

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 –

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.

Running Application

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.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.

Sanjay KumarHello friends, I am Sanjay Kumar a Web Developer by profession. Additionally I'm also a Blogger, Youtuber by Passion. I founded Online Web Tutor and Skillshike platforms. By using these platforms I am sharing the valuable knowledge of Programming, Tips and Tricks, Programming Standards and more what I have with you all. Read more