Blog-CMS-System-PHP

PHP Blog CMS

A simple Blog Content Management System (CMS) built using PHP and MySQL. This application provides a basic web interface for creating, reading, updating, and deleting (CRUD) blog posts. It is designed for learning and development purposes, and can be extended with features like user authentication, comments, and an administrative dashboard.

Table of Contents

  1. Overview
  2. Features
  3. Architecture & Design
  4. Tech Stack
  5. Installation & Setup
  6. Database Schema
  7. File Structure
  8. Usage
  9. Testing
  10. Deployment
  11. Security Considerations
  12. Future Enhancements
  13. Troubleshooting & FAQ
  14. Contributing
  15. License

Overview

The PHP Blog CMS is a lightweight content management system that allows users to manage blog posts through a simple web interface. It demonstrates the basics of PHP with SQL persistence using PDO and MySQL. The application covers core CRUD operations and provides a foundation to expand with advanced features like user authentication, search, and SEO-friendly URLs.


Features


Architecture & Design

System Overview

Component Breakdown


Tech Stack


Installation & Setup

Prerequisites

Local Setup

  1. Clone the Repository

    git clone https://github.com/your-username/php-blog-cms.git
    cd php-blog-cms
    
  2. Configure Environment

    Create a file named config.php in the project root with your database and application settings. Example:

    <?php
    // config.php
    define('DB_HOST', 'localhost');
    define('DB_NAME', 'blog_cms');
    define('DB_USER', 'your_db_username');
    define('DB_PASS', 'your_db_password');
    define('BASE_URL', 'http://localhost/blog-cms/');
    date_default_timezone_set('UTC');
    
    try {
        $pdo = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    } catch (PDOException $e) {
        die("Could not connect to the database " . DB_NAME . ": " . $e->getMessage());
    }
    ?>
    
  3. Set Up the Database


Database Schema

The SQL schema in database/schema.sql sets up the following tables:


File Structure

php-blog-cms/
├── config.php
├── index.php
├── create_post.php
├── view_post.php
├── edit_post.php
├── delete_post.php
├── inc/
│   ├── header.php
│   └── footer.php
└── database/
    └── schema.sql

Usage

Web Interface

Running the Application with PHP’s Built-In Server

From the project directory, run:

php -S localhost:8000

Then, open your browser at http://localhost:8000.


Testing

Manual Testing

Automated Testing


Deployment

Apache/Nginx Setup

Docker Deployment

A sample Dockerfile and docker-compose.yml are provided (see documentation below for details):


Security Considerations


Future Enhancements


Troubleshooting & FAQ


Contributing

Contributions are welcome! Follow these steps:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/your-feature.
  3. Commit your changes with clear messages.
  4. Push your branch and open a pull request detailing your changes.

Please adhere to the coding standards and include tests where applicable.


License

This project is licensed under the MIT License.


Authors

The UNC-CH Google Developer Student Club (GDSC) team.