DaFT Installation Guide
Follow the steps below to get DaFT up and running on your server.
1. Clone the Repository
Begin by cloning the repository to your local machine or server:
git clone https://github.com/andydixon/DaFT.git
cd DaFT
Alternatively, you can download the repository as a ZIP file from GitHub, extract it, and navigate to the extracted directory.
2. Install Dependencies
Ensure the following PHP modules are installed:
php-pecl-mysql php-pecl-raphf php-pecl-pq php-common php-pdo php-odbc php-mysqlnd php-mbstring php-opcache php-sodium php-xml php-curl php-json
Ensure you have Composer installed on your system. Then, run the following command to install the PHP dependencies:
composer install
This will download and set up all necessary libraries required by the project.
3. Set Permissions
For proper operation, ensure that your web server user (typically www-data
for Apache/nginx on Debian/Ubuntu systems, or apache
on CentOS/RHEL) has the correct permissions.
Recommended steps:
# Adjust ownership
sudo chown -R www-data:www-data /path/to/DaFT
# Adjust permissions
sudo find /path/to/DaFT -type d -exec chmod 755 {} \;
sudo find /path/to/DaFT -type f -exec chmod 644 {} \;
(Adjust /path/to/DaFT
to the full path of your installation directory.)
4. Configure Web Server
Ensure your web server's document root points to the /public
directory inside your DaFT project.
For example, if you are using Apache or nginx, set the root as follows:
/path/to/DaFT/public
This keeps the core application files out of the publicly accessible web root.
5. Enable URL Rewriting
To handle routing correctly, you need to configure your web server to redirect all requests to index.php
.
Apache Configuration
Ensure that mod_rewrite
is enabled:
sudo a2enmod rewrite
sudo systemctl restart apache2
Then, in your Apache site configuration (usually found at /etc/apache2/sites-available/your-site.conf
), update your <VirtualHost>
block:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /path/to/DaFT/public
<Directory /path/to/DaFT/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Important:
Make sure AllowOverride All
is set — this allows .htaccess
to take effect.
Create or confirm your .htaccess
file in the /public
directory includes the following:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
nginx Configuration
For nginx, update your server block (typically in /etc/nginx/sites-available/your-site
) as follows:
server {
listen 80;
server_name your-domain.com;
root /path/to/DaFT/public;
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/php8.1-fpm.sock; # Adjust PHP version/socket if necessary
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
error_log /var/log/nginx/daft_error.log;
access_log /var/log/nginx/daft_access.log;
}
After making changes, test your nginx configuration and reload:
sudo nginx -t
sudo systemctl reload nginx
6. Final Steps
Once all the above is complete, you should be able to access your application by navigating to your server's domain or IP address.
Troubleshooting
- If you encounter 404 errors, double-check your rewrite rules and ensure the server is reading them properly.
- Ensure PHP is correctly installed and the appropriate PHP-FPM service is running (especially for nginx setups).
- Check file and folder permissions if you see errors related to reading or writing files.