Git Product home page Git Product logo

base-distribution's Introduction

phpList 4 base distribution

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

About phpList

phpList is an open source newsletter manager. This project is a rewrite of the original phpList.

About this package

This module is the basis for a phpList 4 installation. It will pull in the phplist/core module (the phpList 4 core) and by default also the phplist/rest-api module (the new REST API package). The rest-api dependency is optional.

This package is intended to be cloned and then modified. It is not intended to be updated via Composer after the initial install (although updating the dependencies via composer update is fine).

This (i.e., the downloaded package) is also the place where configuration files will be stored (or symlinked to).

Installation

  1. Download and install composer.
  2. Run composer create-project -s dev --no-dev phplist/base-distribution your-project (use any name you like for the your-project directory).
  3. Switch to the your-project directory.
  4. If you would like to not have the REST API, edit the composer.json, remove the corresponding phplist/rest-api requirement, and run composer update.

Configuring and running phpList on a web server

The phpList application is configured so that the built-in PHP web server can run in development and testing mode, while Apache can run in production mode.

Production on Apache

  1. In the Apache virtual host configuration, set the directory public/ as the document root.
  2. Set a random 40-character hex secret and the phpList database credentials in the Apache virtual host configuration. Your Apache 2.4 configuration then could look like this:
<VirtualHost *:80>
    ServerName domain.tld
    ServerAlias www.domain.tld

    DocumentRoot /var/www/project/public
    <Directory /var/www/project/public>
        AllowOverride All
        Require all granted
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    # <Directory /var/www/project>
    #     Options FollowSymlinks
    # </Directory>

    SetEnv PHPLIST_SECRET f75365ecb07c725ba05d5361e415a328880360e5
    SetEnv PHPLIST_DATABASE_NAME phplist
    SetEnv PHPLIST_DATABASE_USER phplist
    SetEnv PHPLIST_DATABASE_PASSWORD correctHorseBatteryStaple

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

Then reload or restart Apache to activate the configuration changes.

If you cannot set any environment variables in your Apache configuration, you can also set the database credentials in config/parameters.yml. However, this should only be used as a last resort as this reduces security (as an attacker with read access to the files on the web server then could read that file, whereas they then still would not be able to access the environment variables).

Use the following optimized configuration to disable .htaccess support and increase web server performance:

<VirtualHost *:80>
    ServerName domain.tld
    ServerAlias www.domain.tld

    DocumentRoot /var/www/project/public
    <Directory /var/www/project/public>
        AllowOverride None
        Order Allow,Deny
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ app.php [QSA,L]
        </IfModule>
    </Directory>

    SetEnv PHPLIST_SECRET f75365ecb07c725ba05d5361e415a328880360e5
    SetEnv PHPLIST_DATABASE_NAME phplist
    SetEnv PHPLIST_DATABASE_USER phplist
    SetEnv PHPLIST_DATABASE_PASSWORD correctHorseBatteryStaple

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

Development

For running the application in development mode using the built-in PHP server, use this command:

bin/console server:run -d public/

The server will then listen on http://127.0.0.1:8000 (or, if port 8000 is already in use, on the next free port after 8000).

You can stop the server with CTRL + C.

Testing

To run the server in testing mode (which normally will only be needed for the automated tests, provide the --env option:

bin/console server:run -d public/ --env=test

Useful Composer scripts

You can get a list of all installed phpList modules with this command:

composer run-script list-modules

Creating a .tar.gz package of this distribution

These are the steps to create a package for version 4.0.x-dev with the file name phplist-base-distribution-4.0.x-dev.tar.gz:

composer create-project phplist/base-distribution phplist 4.0.x-dev --prefer-dist --no-dev -s dev
tar -cvzf phplist-base-distribution-4.0.x-dev.tar.gz phplist

These steps assume that tar and composer are installed on your machine, and that composer is in your path (and that it is named composer, not composer.phar).

Contributing to this package

Please read the contribution guide on how to contribute and how to run the unit tests and style checks locally.

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code.

base-distribution's People

Contributors

fenn-cs avatar michield avatar oliverklee avatar schmidtsabine avatar xh3n1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

base-distribution's Issues

Add documentation for regarding config file and web root

Please add documentation explaining:

  • Where the database configuration should be set. E.g. should /vendor/phplist/phplist4-core/Configuration/config.ini.dist be copied and modified?
  • What directory should be set as the web root? E.g. /vendor/phplist/phplist4-core/Public/ ? Using that directory gives the following error:
    PHP Fatal error: require_once(): Failed opening required '/var/www/pl4-base-distribution/vendor/phplist/phplist4-core/Public/../vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/pl4-base-distribution/vendor/phplist/phplist4-core/Public/index.php on line 6

If this is already documented in another module repository, a 'See also' note or similar would be useful, as this base-distribution will presumably be the first interaction with phpList 4 for many developers.

Stable version required by composer but none available

Short problem description

Composer fails to create the project due to lack of a stable version of this package

Steps to reproduce

  1. Execute $ composer create-project phplist/base-distribution
  2. Get error: [InvalidArgumentException] Could not find package phplist/base-distribution with stability stable.

Expected behaviour

Composer creates the project successfully

Actual behaviour

Error printed

System configuration

Package version

NA

PHP and Composer version

PHP 7.1.7 (cli) (built: Jul 6 2017 12:10:54) ( NTS )
Composer version 1.5-dev (27ee47def7648652615979e504d6bcc2e7f4bdef)

[META] phase 3

/vendor/phplist/phplist4-core/vendor/autoload.php not found

With a clean installation of the base distribution, running on the local PHP development server, the following error occurs when loading the index page in browser via http://127.0.0.1:8000/

[Sat Sep 30 12:16:31 2017] PHP Warning:  require(/var/www/base-dist/vendor/phplist/phplist4-core/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/base-dist/vendor/phplist/phplist4-core/web/app_dev.php on line 7
[Sat Sep 30 12:16:31 2017] PHP Stack trace:
[Sat Sep 30 12:16:31 2017] PHP   1. {main}() /var/www/base-dist/vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:0
[Sat Sep 30 12:16:31 2017] PHP   2. require() /var/www/base-dist/vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42

'client denied by server configuration' in /.htaccess

/.htaccess appears to be preventing access to the index page of /web when the base distribution is hosted by Apache.

[Sat Sep 30 12:26:35.310824 2017] [authz_core:error] [pid 14499] [client 127.0.0.1:45252] AH01630: client denied by server configuration: /var/www/base-dist/web/

Relevant section of httpd.conf:

<VirtualHost *:80>
        DocumentRoot /var/www/base-dist/web

        <Directory /var/www/base-dist/web>
            AllowOverride All
            Order Allow,Deny
            Allow from All
        </Directory>

        ServerName local.base-dist
        SetEnv PHPLIST_DATABASE_NAME foo
        SetEnv PHPLIST_DATABASE_USER bar
        SetEnv PHPLIST_DATABASE_PASSWORD bam
</VirtualHost>

Client denied by server configuration for

Short problem description

A plugin URL is going 403 and I can't found why.

Steps to reproduce

From the editor, I go to the image server browsing, calling this url:

https://mailing.site.org/lists/admin/plugins/fckphplist/fckeditor/editor/filemanager/connectors/php/connector.php?Command=GetFoldersAndFiles&Type=File&CurrentFolder=%2F&uuid=1530137988035

Expected behaviour

The URL should be accessible.

Actual behaviour

[Thu Jun 28 00:45:41.966389 2018] [authz_core:debug] [pid 13187] mod_authz_core.c(809): [client 90.110.6.214:43194] AH01626: authorization result of Require all denied: denied
[Thu Jun 28 00:45:41.966482 2018] [authz_core:debug] [pid 13187] mod_authz_core.c(809): [client 90.110.6.214:43194] AH01626: authorization result of <RequireAny>: denied
[Thu Jun 28 00:45:41.966568 2018] [authz_core:error] [pid 13187] [client 90.110.6.214:43194] AH01630: client denied by server configuration: /var/www/site.org/mailing/current/web/lists/admin/plugins/fckphplist/fckeditor/editor/filemanager/connectors/php/connector.php

If there are any error messages, please include those as well.

System configuration

Package version

3.3.1

PHP and Composer version

PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May  9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
Composer version 1.6.3 2018-01-31 16:28:17

Apache (2.4) configuration

<VirtualHost *:443>
    ServerName mailing.site.org
    DocumentRoot /var/www/site.org/mailing/current/web

    <Directory "/var/www/site.org/mailing/current/web">
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/mailing.site-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    CustomLog ${APACHE_LOG_DIR}/mailing.site-access.log combined

    Include /etc/apache2/sites-ssl/site-org.ssl.conf
    Include /etc/apache2/letsencrypt.conf
</VirtualHost>

Packaging script

  1. composer install should work without DB credentials
  2. composer create-project should not warm any caches (as those would wind up in the created ZIP)
  3. something like:
    composer create-project phplist/base-distribution phplist 4.0.x-dev --prefer-dist --no-dev --stability=dev
  4. automatically create a TGZ with the version number in the file name

`list-modules` script prints two lines per module

The composer script list-modules prints two lines per found module. Is this as intended? E.g.:

$ composer run-script list-modules
> PhpList\PhpList4\Composer\ScriptHandler::listModules
phplist/phplist4-core  4.0.x-dev
phplist/phplist4-core  dev-master
phplist/rest-api       4.0.x-dev
phplist/rest-api       dev-master

`composer create-project` fails with "No such file or directory"

Short description

While installing the base distribution using the supplied instructions, the following error occurs:

$ composer create-project -s dev --no-dev phplist/base-distribution your-project
> cp -rf vendor/phplist/phplist4-core/web/ .
cp: cannot stat 'vendor/phplist/phplist4-core/web/': No such file or directory
Script cp -rf vendor/phplist/phplist4-core/web/ . handling the document-root event returned with error code 1

PHP and Composer version

Composer version 1.5-dev (27ee47def7648652615979e504d6bcc2e7f4bdef) 2017-05-31 14:05:54
PHP 7.1.7 (cli) (built: Jul 6 2017 12:10:54) ( NTS )

[META] base distribution phase 2

This meta ticket covers the base-distribution-related tasks for phase 2. The core-specific tasks are listed in phpList/core#125, the rest-api-specific tasks are listed in phpList/rest-api#20, and the web-frontend-specific-tasks are listed in phpList/web-frontend#16.

  • make sure Composer installs the latest version of the dependencies (should be fixed as it was a Packagist configuration issue)
  • #19 remove the web-frontend dependency
  • #16, #20 make the package installable via composer create-project
  • #21 rename the branch alias from 4.0.0-dev to 4.0.x-dev https://getcomposer.org/doc/articles/aliases.md#branch-alias
  • #22, automatically set up the document root and document this
  • #17, #22 document the installation process
  • add CI stuff for this package
  • #24 add the symfony console
  • #29 prevent access to the application root directory
  • #30 document the Apache settings (with examples)
  • #25 document how to use the different application contexts
  • #31 use the bin/ and web/ generation script from the core
  • #32 set up the log and cache directories
  • #25, #33 document running phpList in development and testing mode
  • #43 automatically clear and warm all caches on composer update
  • #49 add a structure for a configuration file that is outside the vendor folder
  • document how to create downloadable tgz/zip packages

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.