-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupScript.sh
More file actions
52 lines (39 loc) · 1.04 KB
/
setupScript.sh
File metadata and controls
52 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /bin/bash
if [[ -f "config/config.php" ]]; then
echo "Starting server at port 8000"
cd public
php -S localhost:8000
else
echo "Create a new database in your mysql"
read -n 1 -r -s -p $'Press enter after creating new database has been created\n'
echo "Enter your details"
$DB_HOST
echo "Enter DB_HOST:"
read DB_HOST
$DB_PORT
echo "Enter DB_PORT:"
read DB_PORT
$DB_NAME
echo "Enter DB_NAME:"
read DB_NAME
$DB_USERNAME
echo "Enter DB_USERNAME:"
read DB_USERNAME
$DB_PASSWORD
echo "Enter DB_PASSWORD:"
read DB_PASSWORD
touch config/config.php
echo "<?php">>config/config.php
echo "$DB_HOST= "$DB_HOST";">>config/config.php
echo "$DB_PORT= "$DB_PORT";">>config/config.php
echo "$DB_NAME= "$DB_NAME";">>config/config.php
echo "$DB_USERNAME= "$DB_USERNAME";">>config/config.php
echo '$DB_PASSWORD= '$DB_PASSWORD';'>>config/config.php
echo '?>'>>config/config.php
mysql -u $DB_USERNAME -p $DB_NAME<database.sql
composer install
composer dumpautoload
echo "Starting server at port 8000"
cd public
php -S localhost:8000
fi