GreenBlog is a lightweight, secure, and fast blogging platform that serves as a minimalist alternative to WordPress. It uses PHP and SQLite with ADODB for database operations and generates static HTML files for optimal performance.
- Lightweight: Minimal dependencies and low resource usage
- Secure: Built with security best practices
- Fast: Generates static HTML files for optimal performance
- Simple: Easy to install and use
- Minimal Configuration: Works with standard Apache setups
- PHP 7.4 or higher
- SQLite 3 with PHP SQLite3 extension enabled
- Apache web server with mod_rewrite enabled
- Composer (for installation)
-
Download or clone the repository
git clone https://github.com/yourusername/greenblog.git cd greenblog -
Install dependencies using Composer
composer install -
Set file permissions
Make sure the following directories are writable by the web server:
chmod -R 755 data chmod -R 755 public_html/static chmod -R 755 public_html/uploads -
Configure your web server
Make sure your Apache virtual host is configured with mod_rewrite enabled and AllowOverride All.
-
Configure your web server document root
Set your web server's document root to point to the
public_htmldirectory. -
Run the setup script
Navigate to
http://yourdomain.com/setup.phpin your web browser and follow the instructions to complete the installation.
For local development, you can use PHP's built-in web server to serve the public_html directory:
GreenBlog comes with scripts to easily start the development server:
-
Using Batch Script:
scripts\start-server.bat -
Using PowerShell Script:
scripts\start-server.ps1
These scripts will:
- Check if PHP is available in your PATH
- Verify if the SQLite3 extension is loaded
- Start the server on port 8001
You can also start the server manually:
cd /path/to/greenblog
php -S localhost:8000 -t public_html
If you encounter permission errors, make sure you're using the correct syntax with the -t flag:
# INCORRECT (causes permission errors):
php -S localhost:8000 public_html
# CORRECT:
php -S localhost:8000 -t public_html
This will start a local development server that serves files from the public_html directory.
Notes:
- This is for development purposes only and should not be used in production
- The server will run until you stop it (Ctrl+C)
- You can change the port number (8000/8001) to any available port on your system
- Access the admin interface at http://localhost:8001/admin/ (or whichever port you're using)
If you're using XAMPP, WAMP, or a similar local server environment:
- Configure your virtual host to point to the
public_htmldirectory - Access your site through the configured domain name or localhost path
After installation, you can access the admin interface at http://yourdomain.com/admin/.
The admin interface allows you to:
- Create, edit, and delete posts
- Manage categories
- Upload and manage media
- Configure site settings
- Manually regenerate static files
- Log in to the admin interface
- Click on "New Post" to create a new post
- Fill in the title, content, and other details
- Select categories for the post
- Upload a featured image if desired
- Save as draft or publish immediately
GreenBlog automatically generates static HTML files when:
- A post is published or updated
- A category is created or updated
- Site settings are changed
You can also manually regenerate all static files from the admin interface by clicking on "Regenerate Static Files".
public_html/: Web-accessible filesadmin/: Admin interface filesstatic/: Generated static filesuploads/: Media uploadsassets/: CSS, JS, and images
includes/: Core functionalitytemplates/: HTML templatesdata/: SQLite database
- Keep your PHP and SQLite up to date
- Use strong passwords for the admin account
- Regularly back up your database
- Consider using HTTPS for your site
When using version control (like Git) or deploying to a public repository:
- The
.gitignorefile is configured to exclude sensitive data - Never commit the database file (
data/greenblog.db) to a public repository - Consider excluding
includes/config.phpafter setup (uncomment the line in.gitignore) - Be careful with user uploads in
public_html/uploads/- they are excluded by default - Generated static files in
public_html/static/are also excluded
For production environments:
- Set appropriate file permissions (typically 755 for directories, 644 for files)
- Configure your web server to deny direct access to the
includesanddatadirectories - Regularly backup your database and uploaded content
- Consider using a more robust database like MySQL for high-traffic sites
If you encounter errors related to SQLite functions like sqlite_query(), it means your PHP installation is using SQLite3 but the code is trying to use the older SQLite2 driver. Make sure:
- The PHP SQLite3 extension is enabled in your php.ini
- You're using the 'sqlite3' driver in your database connection code:
$conn = ADONewConnection('sqlite3');
If you see the error "SQLite3 extension is not loaded", follow these steps to enable it:
-
Locate your php.ini file:
php --ini -
Open the php.ini file in a text editor (run as administrator)
-
Find the line with
;extension=sqlite3(it has a semicolon at the beginning) -
Remove the semicolon to uncomment the line:
extension=sqlite3 -
Save the file and restart your web server or PHP process
-
Verify the extension is loaded:
php -m | findstr sqliteYou should see "sqlite3" in the output
If you get permission errors when using PHP's built-in server, make sure you're using the correct syntax with the -t flag:
# CORRECT:
php -S localhost:8000 -t public_html
GreenBlog is released under the MIT License. See the LICENSE file for details.