You can download the phptest.php file (will start download in browser), upload to your server and access it with a browser. It will tell you if your server meets the minimal requirements to run our program. This is the easiest way to run the pre-installation test.
We run our sites on Linux CentOS 64 bit version.
Important disclaimer here:
You will need a 64-bit machine if you want to run this
program in production.
This is because MongoDB has limitation of
database size on 32-bit machines.
You can certainly use it on 32-bit machine but you will be limited to a database of only about 2.5 Gigs, which may not be enough for busy sites that plan on growing.
MongoDB uses more disk space than a tranditional database like MySQL, so make sure to have plenty of disk space available.
Also, you should take advantage of MongoDB sharding and spread your data among multiple servers.
This is optional, but recommended for very busy sites in order to improve performance and add fault tolerance.
php 5.3 or later
(We use namespaces, closures, anonymous functions – all the
latest and greatest that php 5.3 has
We hight recommend to use at least php 5.3.3 because it comes with php-fpm, which is the preferred way to run not just this program, but also all php scripts you have.
This is the most efficient way and can outperform the Apache with mod_php by as much as 10 times. Yes, you can run thousands requests per second with it, not possible with mod_php
MongoDB database (main storage back-end)
MySQL 5.X database (optional, but Similar Questions feature will not work without it)
The reason for
this is that MongoDB does not have a full text search feature and we
need it in order to find 'similar' questions as well as using
it for the search feature)
We use MySQL only for it's full text search and only to index/search question titles.
This way we don't
have to require any type of external search engine like Solr.
There is still an option to search by tags, which uses user-supplied tags to find questions that contain
“Any” or “All” tags matching search query. (under development)
mbstring (This project uses php mbstring to offer the top notch first class UTF8 support for all input, including support for UTF8 Tags, Titles, User Names, Questions, Answers)
curl (for communicating to external APIs like Facebook and FriendConnect)
GD (for generating Captcha images and resizing avatars) Without GD the Captcha feature will be automatically disabled
oauth (for working with Twitter API)
pdo (only if using MySQL for search feature)
pdo_mysql (only if using MySQL for search feature)
APC (it's is not installed by default with php 5.3, we highly recommend you use it to speed up the loading of php classes by as much as 500%.
All you have to do is just make sure that apc extension is enabled, it will then be able to cache all of the core classes of our program in the compiled state)
tidy (for sanitizing input in case input is in html format)
The preferred way to use php is by using php fpm, which is distributed with php 5.3
Running php in fastcgi mode, under the control of php-fpm will also enable the very powerful
function fastcgi_finish_request(), which we use throught the site in order to speed up the page
rendering and defer the execution to non web related functions such as API calls and email sending
till after the page has been rendered and connection has been closed by the web server.
We use Lighttpd, but it also perfectly fine to use Apache or Nginx
Even when using Apache, it's best to NOT use the mod_php, but instead run php
controlled by php-fpm and use Apache for serving static files like
images, css and js files.
If you still prefer the old-school mod_php way, that's fine, our program will happily work with with it.
Any email server will do. We use Postfix.
database from MaxMind (you can download a free version or paid version,
Choose Binary Format of GeoLite City)
We use it to map ip to location.
It helps in spam filtering and also can be used to add locations of posters' to the map using Google Maps API or to just display the flag of poster's country.
You notice that memcache is not required. This is because MongoDB itself behaves like a caching server.
Since documents are stored in rich document format, all 'SELECT' queries are extremely simple and fast. There are never any table joins, and in most cases only primary key is used.
We do have the Cache class to cache some data like results or IP to Location lookups, and our Cache class uses MongoDB also, so there is no need to additional cache engine like memcache.
Unzip packaged zip file
Copy the directory to the root directory of your website.
You will have this directory structure:
Configure your webserver to point your site's root directory to the www directory
* Note: Inside the www directory there is a phptest.php file. It's recommended that you run it from your web browser. It will check to see that your server has all the requirements to run Lampcms and will report if anything is missing on your server.
Set writable permissions for the /logs directory
Set writable permissions for the /www/w directory
In www directory rename bootstrap.dist.php to bootstrap.php
For the most basic installation (if you are not interested in running multiple sites using a single instance of Lampcms library) you don't even have to edit the bootstrap.php file
Now inside config directory
Rename !config.ini.dist to !config.ini
Rename acl.ini.dist to acl.ini
Edit !config.ini file
It's a pretty large config file, most of the settings are optional and there are good comments for each option.
There are some required settings you must define:
All settings in the [MONGO] section are important – define connection to your mongo server
[DB] section is for MySQL connection and is optional. MySQL server can be used as a search provider because MySQL has decent full text indexing. Using MySQL as search/index provide you will be able to have a working search form and also MySQL powers similar questions generation.
Other settings you must define for your site are:
SALT – any random string, read comments, this value should be saved somewhere and kept in safe place – if lost then your members will not be able to login back to site.
COOKIE_SALT – similar to SALT but for cookies
[EMAIL_SERVER] section has important setting to define your own email transport. On Linux server it's usually a path to sendmail, on Windows you need to define SMTP server and login/password for your SMTP server.
You don't have to change anything else unless you want to and understand all the comments.
If you want to configure rewrite rules on your webserver for having nice static-looking urls (without having to always point to index.php file) you should read RewriteRules.txt file and can use it for Apache webserver or lighttpd.conf for Lighttpd server.
We don't have rules for Nginx server yet, but you will probably figure it out if you using Nginx.
If you setup rewrite rules then you must also change the value of FILE (in the [URI_PARTS] section of !config.ini) to an empty value. Just read comments above the FILE setting.
If you want to run multiple sites using the same Lampcms library remember that each site needs own copy of www directory with all files, including own bootstrap.php and own config directory.
Optionally you can move config directory to any location you want and in bootstrap just define a path to it.
For developers - all classes contain detailed comment blocks, you can find all the info you need in the code comments