Installation

IndependentPHP requires PHP version 8.1 or higher to be installed on a server. Additionally when installing on a apache webserver, the .htaccess file should be overwriteable to ensure proper configuration. Note that it has been exclusively tested on Apache servers.

FTPSSHXAMPPDatabase

To install using FTP

Assuming you are already connected to a FTP server.

  1. Download IndependentPHP
  2. Extract the contents of the ZIP file
  3. Navigate to the root directory
  4. Upload the files and folders

To install using SSH

Assuming you are already logged in using SSH.

  1. Navigate to the /etc/apache2 folder
    user@server:~$ cd /etc/apache2
  2. Open the apache2.conf file using a text editor
    user@server:/etc/apache2$ nano apache2.conf
  3. Make sure the AllowOverride is set to All
    <Directory /var/www/>
      Options Indexes FollowSymLinks
      AllowOverride All
      Require all granted
    </Directory>
  4. Navigate to the /var/www folder and clone the repository
    user@server:/var/www$ git clone git@github.com:timdanielscode/IndependentPHP.git
  5. Navigate to the /etc/apache2/sites-available folder and open the 000-default.conf file
    user@server:/etc/apache2/sites-available$ nano 000-default.conf
  6. Change the DocumentRoot to /var/www/IndependentPHP/public
    <VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com
    
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/IndependentPHP/public
        
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alrt, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #Loglevel info ssl:warn
        
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf"
        #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>
    
  7. Restart the apache server
    user@server:/etc/apache2/sites-available$ service apache2 restart

To install using XAMPP

Assuming you already installed XAMPP.

  1. Download IndependentPHP
  2. Navigate to the C:/xampp/htdocs folder
  3. Extract the contents of the ZIP file
  4. Open the apache httpd.conf file
  5. Change the DocumentRoot to /var/www/IndependentPHP/public
    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot "C:/xampp/htdocs/IndependentPHP/public"
    <Directory "C:/xampp/htdocs/IndependentPHP/public">
       #
       # Possible values for the Options directive are "None", "All",
       # or any combination of:
       #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
       #
       # Note that "MultiViews" must be named *explicitly* --- "Options All"
       # doesn't give it to you.
       #
       # The Options directive is both complicated and important.  Please see
       # http://httpd.apache.org/docs/2.4/mod/core.html#options
       # for more information.
       #
    
  6. Restart the apache server
Database image

Database setup

Assuming you already have a database.

  1. Navigate to the /config/database/config-example.ini file
  2. Rename this file to: config.ini
  3. Set the correct database configuration credential values for the host, database name, username, and password. Note that the following characters cannot be used inside the config.ini file: ?{}|&~![()^".
    host=
    db=
    user=
    password=
            

Database setup without the config.ini file

Follow the steps below to setup the database without the config.ini file.

  1. Delete the config.ini file
  2. Navigate to the /database/DB.php file
  3. Open the file and search for the try function method
    
      public static function try() {
        
        if(file_exists('../config/database/config.ini');
          
          $ini = parse_ini_file('../config/database/config.ini');
          return new DB($ini['host'], $ini['user'], $ini['password'], $ini['db']);
        }
      }
  4. Remove the if statement and the $ini variable
    
      public static function try() {
        
        return new DB($ini['host'], $ini['user'], $ini['password'], $ini['db']);
      }
  5. Inside the DB instance, pass the database credentials values
    
      public static function try() {
        
        return new DB('your-host', 'your-database-username', 'your-database-password', 'your-database-name');
      }