This guide will help you set up and run the Habit Tracker application on your server or local development environment.
CREATE DATABASE habit_tracker;
CREATE USER 'habit_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON habit_tracker.* TO 'habit_user'@'localhost';
FLUSH PRIVILEGES;
mysql -u habit_user -p habit_tracker < database_schema.sql
git clone https://github.com/your-username/habit-tracker.git
OR
Upload the application files to your web server using FTP or other file transfer methods.
config/database.php file.$host = 'localhost';
$db_name = 'habit_tracker';
$username = 'habit_user';
$password = 'your_password';
chmod 755 -R /path/to/habit-tracker
chmod 777 -R /path/to/habit-tracker/logs
mkdir -p /path/to/habit-tracker/logs
a2enmod rewrite
service apache2 restart
The application includes an .htaccess file in the root directory. Ensure your Apache configuration allows .htaccess files by setting AllowOverride All.
Example configuration in /etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/habit-tracker
<Directory /var/www/habit-tracker>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
service apache2 restart
/etc/nginx/sites-available/habit-tracker:
server {
listen 80;
server_name yourdomain.com;
root /var/www/habit-tracker;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~ /(config|controllers|models|utils) {
deny all;
}
}
ln -s /etc/nginx/sites-available/habit-tracker /etc/nginx/sites-enabled/
service nginx restart
assets/css/ and assets/js/ directories.mkdir -p assets/images/badges
Visit your application URL in a web browser (e.g., http://yourdomain.com or http://localhost/habit-tracker).
You should be redirected to the login page. Click on “Register” to create your first account.
Log in with your new account to access the dashboard.
config/database.php.ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
If you encounter issues not covered in this guide, please:
logs directory.git pull origin main
After updating, check for any database schema changes and apply them if necessary.
rm -rf /path/to/habit-tracker/cache/*
This Habit Tracker application is released under the MIT License. See the LICENSE file for more details.