CakePHP Get Version

To find out current version of CakePHP, we can use following methods:

  • CakePHP 2.x

Open lib/Cake/VERSION.txt file, the version number is at bottom of file.

 

  • CakePHP 3.x

Open vendor/cakephp/cakephp/VERSION.txt file, the version number is at bottom of file.

 

And if you want to get version in code, we can use following code

 

Under the Hood

The Configure class is defined at lib/Cake/Core/Configuration.php file, reading the code we will find it's actually reading the VERSION.txt file (the file we mentioned above) to find out current version as well.

Access PHP built-in web server from other devices

We often use following command to start the PHP built-in web server.

php -S localhost:port

But in this way only the machine which starts the server can access it, any other computers cannot access it.
To solve this problem, we can use 0.0.0.0 as the binding IP address

php -S 0.0.0.0:8000

Then other devices are able to access our server as well. Using 0.0.0.0 as the IP addres will make the server bind all available IP addresses on the machine.

Drupal Get User ID

In Drupal the logged in user is stored as a global variable. Following code can access the logged in user ID

And in profile page, you can use $user variable directly