# Getting Started

This documentation describes how to get started with SocialEngine PHP.

## Requirements

### Minimum

- Apache-based VPS web server
- Apache mod_rewrite (for SEO-friendly URLs)
- MySQL 5.7
- PHP 8.2
- PHP configuration options
  - magic_quotes_gpc=Off
  - safe_mode=Off
- PHP extensions
  - GD2(image processing)
  - cURL(fetching URLs)
  - iconv(required for non-English support)
  - IntlChar (required for Unicode characters support for mobile apps)
  - Imagick (ImageMagick) required for gif image support and mobile device image rotation
  - MySQLi
- PHP memory limit: 32M+
- Sendmail
- Disable mod_security/mod_security2
- Disable open_basedir
- OpenSSL ENABLED

### Recommended

- Apache-based VPS or dedicated web server
- PHP 8.2
- MySQL 8 or newer
- crontab
- dom(required for link previews)

### Optional

- memcached (speed boost)
- PHP extensions:
  - bcmath(speed boost)
  - hash OR mhash(required for Amazon S3 support)
  - json(speed boost)
  - mbstring(required for non-English support)
  - mysqli OR pdo_mysql(more reliable SQL support)

### Optional Requirements for Video Plugin

- ffmpeg (for encoding video) - without ffmpeg, users can still post YouTube and Vimeo videos.

### How do I check if my host is compatible with SocialEngine PHP?

Most modern hosting providers are compatible with SocialEngine PHP, but if in doubt you can contact them directly and refer them to this page SocialEngine Requirements.

## Installing SocialEngine

### Video

### Instructions

Please follow the instructions below or refer to our knowledge base Installation Instructions.

1. In order to install SocialEngine, you need four pieces of information. If you don't have any of these, please contact your hosting provider and ask them for assistance.
   - MySQL Server Address (often "localhost", "127.0.0.1", or the server IP address)
   - MySQL Database Name
   - MySQL Username
   - MySQL Password
2. Download the SocialEngine PHP ZIP file and extract it to your computer.
3. Upload all of the files to your hosting account (it can exist either in the root HTML directory, or a subdirectory).
   - If you are using a Unix server (or Unix variant, like Linux, OS X, FreeBSD, etc.) you must set the permissions (CHMOD) of the following directories and files to 777:
     - `/install/config/` (recursively; all directories and files contained within this must also be changed)
     - `/temporary/` (recursively; all directories and files contained within this must also be changed)
     - `/public/` (recursively; all directories and files contained within this must also be changed)
     - `/application/themes/` (recursively; all directories and files contained within this should also be changed)
     - `/application/packages/` (recursively; all directories and files contained within this should also be changed)
     - `/application/languages/` (recursively; all directories and files contained within this must also be changed)
     - `/application/settings/` (recursively; all files contained within this must also be changed)
4. Access the SocialEngine installer by accessing your website; the installer wizard will automatically begin.

### Signing In

Member and Admin accounts are unified in SocialEngine, so you as the site owner can use the same username and password to access the website. A user account with super-admin privileges is created for you during the installation process. Additional user accounts can be created via the signup process, and specific privileges can be assigned by you, the admin, after the account has been created.

To access the admin panel, please follow this tutorial at our knowledge base, Accessing the Admin Panel.

## Plugin Installation

Plugin installation will function similar to the SocialEngine upgrade process.

### Video

### Instructions

To install plugins, please follow the instructions below, or refer to our knowledge base plugin installation tutorial.

1. Download each of the plugin TAR files you wish to install.
2. Log in to your SocialEngine site and access the Admin area.
3. Access the Manage menu and click on Packages & Plugins.
4. Click on the Install New Packages link, then on the Add Packages link.
5. Select the TAR files you download in step 1
6. Follow the step-by-step wizard to complete the installation of the plugin files.

## Upgrading SocialEngine

SocialEngine PHP supports upgrades via our package manager in the Admin panel. Please follow the instructions below or refer to our knowledge base Performing Upgrades tutorial

### Video

#### Instructions

1. Download the latest Core Upgrade available from your SocialEngine Client area.
2. Log in to your SocialEngine site and access the Admin area.
3. Access the Manage menu and click on Packages & Plugins.
4. Click on the Install New Packages link, then on the Add Packages link.
5. Select the Core Upgrade file you download in step 1. After the file is uploaded, a Continue button will appear at the bottom of the page.
   Note: if you have trouble uploading the files using the uploader tool, you can also upload the TAR file manually over FTP to the `/temporary/package/archive/` directory.
6. Follow the step-by-step wizard to complete the upgrade of the Core files.

## Developers Guide

### Tools

While the following are not necessary for modifying SocialEngine PHP, we recommend the following tools for your development environment.

- Netbeans IDE ( https://netbeans.org/features/php/ )
- PhpStorm ( https://www.jetbrains.com/phpstorm/ )
- Set SocialEngine to be in "Development" mode (see `Admin > Settings > General Settings`). This prevents the use of caching, while also enables error messages to be displayed to the front-end interface.

### Structure

SocialEngine is based on the Zend Framework, and is built in an MVC (Model-View-Controller) structure. It is also built with modularity in mind.

The directory structure is as follows:

- `/application/`
  This directory contains the majority of SocialEngine files.
  - `/application/languages/`
    See the section below on Languages
  - `/application/libraries/`
    Third party PHP libraries are typically contained in here. For example, Zend Framework and CSS Scaffold both live in this directory, as does our extensions to Zend Framework (called Engine).
  - `/application/modules/`
    See the section below on Plugins
  - `/application/settings/`
    These files contain configurations that typically will not be modified after your initial installation. Things like your database username/password, cache settings, mail settings, etc. are stored in here.
  - `/application/themes/`
    See the section below on Themes
- `/development/`
  Various tools that we have used during development are contained in this directory. You can mostly ignore these files.
- `/externals/`
  Most of our images, javascript libraries, and flash applications that are used globally are retained in this directory. These should contain trusted (i.e. not user-uploaded) content.
- `/public/`
  User-uploaded content is always contained in here. This directory should be both web-accessible and writable by the web server (chmod 777 recursively).
- `/temporary/`
  Various temporary files, such as cache files, logs, session files, etc. are stored in this directory. It should not be web-accessible, but must be writable by the web server (chmod 777 recursively). We provide an ".htaccess" file to block access to this directory from the web browser, but if you are using a web server other than Apache, we recommend you configure the web server accordingly to prevent view access.

### Plugins

`/application/modules/*`

Most of SocialEngine's functionality resides here. Each module contains within it the MVC structure, where the "Model", "views", and "controllers" directories correspond to the MVC paths. Please see our included skeleton module "HelloWorld" for more information on this.

### Languages

`/application/languages/*`

Each language gets its own two-letter (or 5-character with localization support) directory in this subdirectory. The language files are in multiple CSV files, though they are concatenated into one large CSV file (in no particular order, except that "custom.csv" is the last). One important point to keep in mind is that duplicate keys override previously defined keys. So, for example, if you have a key "Turtles are fast!" in both core.csv and custom.csv, since custom.csv is loaded last, the value set to "Turtles run fast!" in custom.csv will be the one used.

The CSV files have several requirements:

- Each line has at minimum two columns, and can contain more for different pluralizations.
- Each column is separated using a semicolon, and is enclosed in "double-quotes" if it contains any sort of white-space (we recommend wrapping your values in quotes in all cases just to be safe).
- The first column is always going to be the `key`. This is the English word or phrase that exists in the view script, controller, or other portion of the code.
- The second column is always going to be the default translation of the `key`.
- If there is a subsequent columns after the second column, it will be for various pluralizations of the `key`.
- Untranslated variables can be contained within a translation `key` and translations. Variable replacement is done using the PHP function sprintf , and so the same rules apply. When only one variable is being injected into a translation, typically "%s" is the placeholder for that variable. If multiple variables are being injected, you can use "%1$s", "%2$s", "%3$s" etc to put the variables in their proper positions for your translation.
- If your translation has double-quotes in it, you must use two double-quotes. So as an example, the sentence 'He said "wow".' would appear in a CSV files as:
  `"He said ""wow"".";"He said ""wow""."`

### Themes

`/application/themes/*`

We utilize a framework called "CSS Scaffold" which makes editing your community's theme a simple process. Each theme is stored in its own directory within `/applications/themes/`. A default theme is automatically loaded when you first install SocialEngine. Each theme contains two files: constants.css and theme.css.

At the top of constants.css, you'll find a series of global CSS settings (called "constants"). You can edit these to adjust the colors, fonts, and other styles throughout your entire community.

The other file, theme.css, contains more specific styles that are used throughout your community. Many of these styles inherit values from constants.css. If you want to override any of the default styles on your community, you can edit them here. If they aren't present in theme.css (and are being loaded from outside the theme itself), you can override them by adding new styles to the bottom of theme.css.

More information about how to work with CSS Scaffold is available here: https://github.com/sunny/csscaffold or Google for CSScaffold for videos and tutorials.

Copyright © 2007 -
SocialEngine