Difference between revisions of "RecipeApp"
(Created page with "== Recipe App == ''''1. Install Packages '''' <pre> sudo apt update sudo apt install apache2 sqlite3 libsqlite3-dev libapache2-mod-php php-sqlite3 </pre> ''''If your Apache uses a specific PHP version, install SQLite for that version. Check Apache PHP:'''' <pre> apachectl -M | grep -i php ls -la /etc/apache2/mods-enabled/php*.load </pre> '''' Example: if Apache uses PHP 8.1:'''' <pre> sudo apt install php8.1-sqlite3 sudo phpenmod -v 8.1 -s apache2 pdo_sqlite sqlit...") |
|||
| Line 86: | Line 86: | ||
</pre> | </pre> | ||
''''If config test says Syntax OK, Apache is good. | ''''If config test says Syntax OK, Apache is good.''' | ||
5. Test App From Server | '''5. Test App From Server''' | ||
From the app folder: '''' | '''From the app folder: '''' | ||
<pre> | <pre> | ||
| Line 97: | Line 97: | ||
</pre> | </pre> | ||
'''7. Optional HTTPS | '''7. Optional HTTPS | ||
Install Certbot:''' | Install Certbot:''' | ||
| Line 133: | Line 133: | ||
sudo systemctl restart apache2 | sudo systemctl restart apache2 | ||
If you see permission errors for SQLite or uploads: | '''If you see permission errors for SQLite or uploads:''' | ||
sudo chown -R www-data:www-data /var/www/html/11square/data /var/www/html/11square/uploads | |||
sudo chmod -R 775 /var/www/html/11square/data /var/www/html/11square/uploads | sudo chown -R www-data:www-data /var/www/html/11square/data /var/www/html/11square/uploads | ||
sudo chmod -R 775 /var/www/html/11square/data /var/www/html/11square/uploads | |||
Back up these folders/files: | |||
/var/www/html/11square/data/cocktails.sqlite | '''Back up these folders/files:''' | ||
/var/www/html/11square/uploads/ | |||
Those contain your saved recipes and uploaded images. | /var/www/html/11square/data/cocktails.sqlite | ||
/var/www/html/11square/uploads/ | |||
'''Those contain your saved recipes and uploaded images.''' | |||
Revision as of 19:41, 10 June 2026
Recipe App
'1. Install Packages '
sudo apt update sudo apt install apache2 sqlite3 libsqlite3-dev libapache2-mod-php php-sqlite3
'If your Apache uses a specific PHP version, install SQLite for that version. Check Apache PHP:'
apachectl -M | grep -i php ls -la /etc/apache2/mods-enabled/php*.load
' Example: if Apache uses PHP 8.1:'
sudo apt install php8.1-sqlite3 sudo phpenmod -v 8.1 -s apache2 pdo_sqlite sqlite3 sudo systemctl restart apache2
' Verify SQLite support:'
php -m | grep -i sqlite ls -la /etc/php/*/apache2/conf.d/ | grep sqlite
' You should see:'
pdo_sqlite sqlite3
' 2. Copy App Files Example location:3. Set Permissions Apache must write to SQLite and image upload folders:'
cd /var/www/html/11square sudo mkdir -p data uploads/recipes sudo chown -R www-data:www-data data uploads sudo chmod -R 775 data uploads
' Do not make the whole app writable unless needed. Only data/ and uploads/ need write access. 4. Apache Virtual Host Create a site config:'
sudo nano /etc/apache2/sites-available/11square.conf
' '
<VirtualHost *:80>
ServerName 11square.com
ServerAlias www.11square.com
DocumentRoot /var/www/html/11square
<Directory /var/www/html/11square>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/11square-error.log
CustomLog ${APACHE_LOG_DIR}/11square-access.log combined
</VirtualHost>
'Enable the site: '
sudo a2ensite 11square.conf sudo a2enmod rewrite sudo apachectl configtest sudo systemctl restart apache2
'If config test says Syntax OK, Apache is good. 5. Test App From Server From the app folder: '
cd /var/www/html/11square php -l index.php php -l lib/Database.php
7. Optional HTTPS
Install Certbot:
sudo apt install certbot python3-certbot-apache
Issue certificate:
sudo certbot --apache -d 11square.com -d www.11square.com
Then test:
sudo apachectl configtest sudo systemctl restart apache2
8. Common Troubleshooting Check Apache/PHP errors:
sudo tail -n 100 /var/log/apache2/11square-error.log sudo tail -n 100 /var/log/apache2/error.log
Watch live while refreshing the browser:
sudo tail -f /var/log/apache2/11square-error.log
If you see:
PDOException: could not find driver Install SQLite for Apache’s active PHP version:
ls -la /etc/apache2/mods-enabled/php*.load sudo apt install php8.1-sqlite3 sudo phpenmod -v 8.1 -s apache2 pdo_sqlite sqlite3 sudo systemctl restart apache2
If you see permission errors for SQLite or uploads:
sudo chown -R www-data:www-data /var/www/html/11square/data /var/www/html/11square/uploads sudo chmod -R 775 /var/www/html/11square/data /var/www/html/11square/uploads
Back up these folders/files:
/var/www/html/11square/data/cocktails.sqlite /var/www/html/11square/uploads/
Those contain your saved recipes and uploaded images.