How do you create PHP and Laravel environments with databases in Android?

Prerequisites:

An Android Phone with v7.0 or higher

First you need to install termux from Play Store. Here is the app URL : Termux App

Setup Process Of Laravel:

Termux update and upgrade

Run the below command to update and up…


This content originally appeared on DEV Community and was authored by AJDM Jakiur Rahmam

Prerequisites:

  • An Android Phone with v7.0 or higher

First you need to install termux from Play Store. Here is the app URL : Termux App

Setup Process Of Laravel:

Termux update and upgrade

Run the below command to update and upgrade termux.

apt-get update    # Updates the list of available packages
apt-get upgrade   # Upgrades all installed packages to their latest 

Install PHP and Composer

To install PHP and composer run the following commands.

pkg update
pkg upgrade
pkg install php
pkg install composer

Create your first Laravel project

To create a laravel project run the following command.

composer create laravel/laravel my_first_app

It would help if you had a good internet connection to install the Laravel app.

Run the server

cd my_first_app
php artisan serve

Now to go browser and type http://127.0.0.1:8000

The Laravel server is started at 127.0.0.1:8000

This is the welcome page of laravel

Setup MySQL and PHPMyAdmin:

Install MariaDB with MySQL

Run the following command to install.

pkg install mariadb #install mariadb
mysqld_safe -u root #start the SQL server

Then press ctrl + z and type the following command.

mariadb

Then the following MariaDB interface will show. You can run commands here to create edit delete and update databases and tables.

MariaBD Interface

Setup PHPMyAdmin

To setup PHPMyAdmin run the following commands.

cd ~/
composer create-project phpmyadmin/phpmyadmin

Now we will rename a file name config.sample.inc.php ** to **config.inc.php To do this run the below command in the phpmyadmin directory.

cd phpmyadmin
mv config.sample.inc.php config.inc.php

Now we will edit the config file to allow login without a password.

pkg install vim
vim config.inc.php

Change the AllowNoPassword value from false to true and also change the host from localhost to 127.0.0.1

Config file in vim editor

Go to the line that is showing in the image and then do the following instructions:

i #press i for insert mode

After pressing i change the value from false to true. After that press esc and run the following commands:

:w
:q
php -S localhost:4000

In the another tab of the termux run the command.

mysqld_safe -u root

Now go to http://localhost:4000 and now provide the credintials.
**
username: root
Password:
**
Done! you have successfully setup phpmyadmin with laravel. Now just edit .env file run the command php artisan migrate (of course in a new tab)

A short video of the final output and .env file edit

Thanks for reading the article.


This content originally appeared on DEV Community and was authored by AJDM Jakiur Rahmam


Print Share Comment Cite Upload Translate Updates
APA

AJDM Jakiur Rahmam | Sciencx (2024-10-02T14:58:45+00:00) How do you create PHP and Laravel environments with databases in Android?. Retrieved from https://www.scien.cx/2024/10/02/how-do-you-create-php-and-laravel-environments-with-databases-in-android/

MLA
" » How do you create PHP and Laravel environments with databases in Android?." AJDM Jakiur Rahmam | Sciencx - Wednesday October 2, 2024, https://www.scien.cx/2024/10/02/how-do-you-create-php-and-laravel-environments-with-databases-in-android/
HARVARD
AJDM Jakiur Rahmam | Sciencx Wednesday October 2, 2024 » How do you create PHP and Laravel environments with databases in Android?., viewed ,<https://www.scien.cx/2024/10/02/how-do-you-create-php-and-laravel-environments-with-databases-in-android/>
VANCOUVER
AJDM Jakiur Rahmam | Sciencx - » How do you create PHP and Laravel environments with databases in Android?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/02/how-do-you-create-php-and-laravel-environments-with-databases-in-android/
CHICAGO
" » How do you create PHP and Laravel environments with databases in Android?." AJDM Jakiur Rahmam | Sciencx - Accessed . https://www.scien.cx/2024/10/02/how-do-you-create-php-and-laravel-environments-with-databases-in-android/
IEEE
" » How do you create PHP and Laravel environments with databases in Android?." AJDM Jakiur Rahmam | Sciencx [Online]. Available: https://www.scien.cx/2024/10/02/how-do-you-create-php-and-laravel-environments-with-databases-in-android/. [Accessed: ]
rf:citation
» How do you create PHP and Laravel environments with databases in Android? | AJDM Jakiur Rahmam | Sciencx | https://www.scien.cx/2024/10/02/how-do-you-create-php-and-laravel-environments-with-databases-in-android/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.