You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

377 lines
16 KiB

  1. Software Installation
  2. We've tried very hard to ensure that this software will run on commodity
  3. hosting platforms - such as those used to host Wordpress blogs and Drupal
  4. websites. It will run on most any Linux VPS system. Windows LAMP platforms
  5. such as XAMPP and WAMP are not officially supported at this time - however
  6. we welcome patches if you manage to get it working.
  7. Be aware that this software is more than a simple web application. It is a
  8. complex communications and content management system which more closely
  9. resembles an email server than a web server. For reliability and performance,
  10. messages are delivered in the background and are queued for later delivery
  11. when sites are down. This kind of functionality requires a bit more of the
  12. host system than the typical blog. Not every PHP/MySQL hosting provider will
  13. be able to support these requirements. Many will - but please review the
  14. requirements and confirm these with your hosting provider prior to
  15. installation. (And preferably before entering into a long-term contract.)
  16. If you encounter installation issues, please let us know via the issue
  17. tracker at https://codeberg.org/zot/zap where you downloaded the software.
  18. Please be as clear as you can about your operating environment and provide as
  19. much detail as possible about any error messages you may see, so that we can
  20. prevent it from happening in the future. Due to the large variety of operating
  21. systems and PHP platforms in existence we may have only limited ability to
  22. debug your PHP installation or acquire any missing modules - but we will do
  23. our best to solve any general code issues.
  24. **Before you begin**
  25. Choose a domain name or subdomain name for your server.
  26. The software can only be installed into the root of a domain or
  27. sub-domain, and can not be installed using alternate TCP ports. These
  28. restrictions may be relaxed in the future, but will be inconvenient to work
  29. with, so we still STRONGLY recommend you abide by them.
  30. SSL is REQUIRED and you MUST use a "browser-valid" certificate. You MUST NOT
  31. use self-signed certificates!
  32. Please test your certificate prior to installation. A web tool for testing your
  33. certificate is available at "http://www.digicert.com/help/". When visiting your
  34. site for the first time, please use the SSL ("https://") URL. This will avoid
  35. problems later.
  36. Free "browser-valid" certificates are available from providers such as StartSSL
  37. and LetsEncrypt.
  38. If you use LetsEncrypt to provide certificates and create a file under
  39. .well-known/acme-challenge so that LetsEncrypt can verify your domain
  40. ownership, please remove or rename the .well-known directory as soon as the
  41. certificate is generated. The software will provide its own handler for
  42. ".well-known" services when it is installed, and an existing directory in this
  43. location may prevent some of these services from working correctly. This
  44. should not be a problem with Apache, but may be an issue with nginx or other
  45. web server platforms.
  46. **Installation**
  47. 1. Requirements
  48. - Apache with mod-rewrite enabled and "AllowOverride All" so you can use a
  49. local .htaccess file. Some folks have successfully used nginx and lighttpd.
  50. Example config scripts are available for these platforms in the install
  51. directory. Apache and nginx have the most support.
  52. - PHP 7.2 or later.
  53. - PHP *command line* access with register_argc_argv set to true in the
  54. php.ini file - and with no hosting provider restrictions on the use of
  55. exec() and proc_open().
  56. - curl, gd (with at least jpeg and png support), mysqli, mbstring, xml,
  57. xmlreader (FreeBSD), zip and openssl extensions. The imagick extension MAY
  58. be used instead of gd, but is not required and MAY also be disabled via
  59. configuration option.
  60. - some form of email server or email gateway such that PHP mail() works.
  61. - Mysql 5.5.3 or later or MariaDB or postgres database server.
  62. Case-insensitive search is not supported on postgres. This is not harmful,
  63. but postgres nodes should probably not be used as directory servers due
  64. to this limitation.
  65. - ability to schedule jobs with cron.
  66. - Installation into a top-level domain or sub-domain (without a
  67. directory/path component in the URL) is REQUIRED.
  68. 2. Unpack the project files into the root of your web server document area.
  69. If you copy the directory tree to your webserver, make sure that you
  70. also copy .htaccess - as "dot" files are often hidden and aren't normally
  71. copied.
  72. - If you are able to do so, we recommend using git to clone the source
  73. repository rather than to use a packaged tar or zip file. This makes the
  74. software much easier to update. The Linux command to clone the repository
  75. into a directory "mywebsite" would be
  76. git clone https://codeberg.org/zot/zap.git mywebsite
  77. - and then you can pick up the latest changes at any time with
  78. git pull
  79. - make sure the folders "cache/smarty3" and "store" exist and are
  80. writable by the webserver.
  81. mkdir -p "store"
  82. mkdir -p "cache/smarty3"
  83. chmod -R 777 store cache
  84. [This permission (777) is very dangerous and if you have sufficient
  85. privilege and knowledge you should make these directories writeable
  86. only by the webserver and, if different, the user that will run the
  87. cron job (see below). In many shared hosting environments this may be
  88. difficult without opening a trouble ticket with your provider. The
  89. above permissions will allow the software to work, but are not
  90. optimal.]
  91. - For installing addons
  92. - First you should be **on** your website folder
  93. cd mywebsite
  94. - Then you should clone the addon repository (separately). We'll give this repository
  95. a nickname of 'zaddons'. You can pull in other addon repositories by
  96. giving them different nicknames.
  97. util/add_addon_repo https://codeberg.org/zot/zap-addons.git zaddons
  98. - For keeping the addon tree updated, you should be on your top level website
  99. directory and issue an update command for that repository.
  100. cd mywebsite
  101. util/update_addon_repo zaddons
  102. 3. Create an empty database and note the access details (hostname, username,
  103. password, database name). The PDO database libraries will fallback to socket
  104. communication if the hostname is 'localhost' and some people have reported
  105. issues with the socket implementation. Use it if your requirements mandate.
  106. Otherwise if the database is served on the local server, use '127.0.0.1' for
  107. the hostname. When using MySQL or MariaDB, please set the database character
  108. encoding to utf8mb4 to avoid encoding issues with emojis. All the internal
  109. tables are created with utf8mb4_general_ci encoding, but issues have been
  110. encountered when using these in a database that was configured for 'utf8'
  111. and not utf8mb4.
  112. Internally we now use the PDO library for database connections. If you
  113. encounter a database configuration which cannot be expressed on the setup form
  114. (for instance using MySQL with an unusual socket location); you can supply
  115. the PDO connection string as the database hostname. For instance
  116. mysql:unix_socket=/my/special/socket_path
  117. You should still fill in all other applicable form values as needed.
  118. 4. If you know in advance that it will be impossible for the web server to
  119. write or create files in your web directory, create an empty file called
  120. .htconfig.php and make it writable by the web server.
  121. 5. Visit your website with a web browser and follow the instructions. Please
  122. note any error messages and correct these before continuing. If you are using
  123. SSL with a known signature authority, use the https: link to your
  124. website.
  125. 6. *If* the automated installation fails for any reason, check the following:
  126. - ".htconfig.php" exists
  127. If not, edit htconfig.php and change system settings. Rename
  128. to .htconfig.php
  129. - Database is populated.
  130. If not, import the contents of "install/schema_xxxxx.sql" with phpmyadmin
  131. or mysql command line (replace 'xxxxx' with your DB type).
  132. 7. At this point visit your website again, and register your personal account.
  133. Registration errors should all be recoverable automatically.
  134. If you get any *critical* failure at this point, it generally indicates the
  135. database was not installed correctly. You might wish to move/rename
  136. .htconfig.php to another name and empty (called 'dropping') the database
  137. tables, so that you can start fresh.
  138. In order for your account to be given administrator access, it should be the
  139. first account created, and the email address provided during registration
  140. must match the "administrator email" address you provided during
  141. installation. Otherwise to give an account administrator access,
  142. add 4096 to the account_roles for that account in the database.
  143. For your site security there is no way to provide administrator access
  144. using web forms.
  145. ****************************************************************************
  146. ****************************************************************************
  147. ******** THIS NEXT STEP IS IMPORTANT!!!! ***********
  148. ****************************************************************************
  149. ****************************************************************************
  150. 8. Set up a cron job or scheduled task to run the Cron manager once every 10-15
  151. minutes to perform background processing and maintenance. Example:
  152. cd /base/directory; /path/to/php Zotlabs/Daemon/Run.php Cron
  153. Change "/base/directory", and "/path/to/php" as appropriate for your situation.
  154. If you are using a Linux server, run "crontab -e" and add a line like the
  155. one shown, substituting for your unique paths and settings:
  156. */10 * * * * cd /home/myname/mywebsite; /usr/bin/php Zotlabs/Daemon/Run.php Cron > /dev/null 2>&1
  157. You can generally find the location of PHP by executing "which php". If you
  158. have troubles with this section please contact your hosting provider for
  159. assistance. The software will not work correctly if you cannot perform this
  160. step.
  161. You should also be sure that App::$config['system']['php_path'] is set
  162. correctly in your .htconfig.php file, it should look like (changing it to the
  163. correct PHP location):
  164. App::$config['system']['php_path'] = '/usr/local/php72/bin/php';
  165. #####################################################################
  166. If things don't work...
  167. #####################################################################
  168. #####################################################################
  169. - If you get the message
  170. "System is currently unavailable. Please try again later"
  171. #####################################################################
  172. Check your database settings. It usually means your database could not be
  173. opened or accessed. If the database resides on the same machine, check that
  174. the database server name is "127.0.0.1" or the word "localhost".
  175. #####################################################################
  176. - 500 Internal Error
  177. #####################################################################
  178. This could be the result of one of our Apache directives not being
  179. supported by your version of Apache. Examine your apache server logs.
  180. Also check your file permissions. Your website and all contents must generally
  181. be world-readable.
  182. It is likely that your web server reported the source of the problem in
  183. its error log files. Please review these system error logs to determine what
  184. caused the problem. Often this will need to be resolved with your hosting
  185. provider or (if self-hosted) your web server configuration.
  186. #####################################################################
  187. - 400 and 4xx "File not found" errors
  188. #####################################################################
  189. First check your file permissions. Your website and all contents must
  190. generally be world-readable.
  191. Ensure that mod-rewite is installed and working, and that your
  192. .htaccess file is being used. To verify the latter, create a file test.out
  193. containing the word "test" in the top web directory, make it world
  194. readable and point your web browser to
  195. http://yoursitenamehere.com/test.out
  196. This file should be blocked. You should get a permission denied message.
  197. If you see the word "test" your Apache configuration is not allowing your
  198. .htaccess file to be used (there are rules in this file to block access
  199. to any file with .out at the end, as these are typically used for system logs).
  200. Make certain the .htaccess file exists and is readable by everybody, then
  201. look for the existence of "AllowOverride None" in the Apache server
  202. configuration for your site. This will need to be changed to
  203. "AllowOverride All".
  204. If you do not see the word "test", your .htaccess is working, but it is
  205. likely that mod-rewrite is not installed in your web server or is not working.
  206. On most flavours of Linux,
  207. % a2enmod rewrite
  208. % service apache2 restart
  209. Consult your hosting provider, experts on your particular Linux
  210. distribution or (if Windows) the provider of your Apache server software if
  211. you need to change either of these and can not figure out how. There is
  212. a lot of help available on the web. Google "mod-rewrite" along with the
  213. name of your operating system distribution or Apache package.
  214. #####################################################################
  215. - If you see an error during database setup that DNS lookup failed
  216. #####################################################################
  217. This is a known issue on some versions of FreeBSD, because
  218. dns_get_record() fails for some lookups. Create a file in your top webserver
  219. folder called '.htpreconfig.php' and inside it put the following:
  220. <?php
  221. App::$config['system']['do_not_check_dns'] = 1;
  222. This should allow installation to proceed. Once the database has been
  223. installed, add the same config statement (but not the '<?php' line) to the
  224. .htconfig.php file which was created during installation.
  225. #####################################################################
  226. - If you are unable to write the file .htconfig.php during installation
  227. due to permissions issues:
  228. #####################################################################
  229. create an empty file with that name and give it world-write permission.
  230. For Linux:
  231. % touch .htconfig.php
  232. % chmod 777 .htconfig.php
  233. Retry the installation. As soon as the database has been created,
  234. ******* this is important *********
  235. % chmod 755 .htconfig.php
  236. #####################################################################
  237. - Apache processes hanging, using as much CPU as they can
  238. #####################################################################
  239. This seems to happen sometimes if you use mpm_prefork and the PHP process
  240. started by Apache cannot get database access.
  241. Consider the following settings:
  242. In /etc/apache2/mods-enabled/mpm_prefork.conf (Debian, path and file name
  243. may vary depending on your OS and distribution), set
  244. GracefulShutdownTimeout 300
  245. This makes sure that Apache processes that are running wild will not do so
  246. forever, but will be killed if they didn't stop five minutes after a
  247. shutdown command was sent to the process.
  248. If you expect high load on your server (public servers, e.g.), also make
  249. sure that Apache will not spawn more processes than MySQL will accept
  250. connections.
  251. In the default Debian configuration, in
  252. /etc/apache2/mods-enabled/mpm_prefork.conf the maximum number of workers
  253. is set to 150:
  254. MaxRequestWorkers 150
  255. However, in /etc/mysql/my.cnf the maximum number of connection is set to
  256. 100:
  257. max_connections = 100
  258. 150 workers are a lot and probably too much for small servers. However you
  259. set those values, make sure that the number of Apache workers is smaller
  260. than the number of connections MySQL accepts, leaving some room for other
  261. stuff on your server that might access MySQL, and the communication poller
  262. whichneeds MySQL access, too. A good setting for a medium-sized hub might be
  263. to keep MySQL's max_connections at 100 and set mpm_prefork's MaxRequestWorkers
  264. to 70.
  265. Here you can read more about Apache performance tuning:
  266. https://httpd.apache.org/docs/2.4/misc/perf-tuning.html
  267. There are tons of scripts to help you with fine-tuning your Apache
  268. installation. Just search with your favorite search engine
  269. 'apache fine-tuning script'.