Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
TYPO3 4.3 Multimedia Cookbook

You're reading from   TYPO3 4.3 Multimedia Cookbook Over 50 great recipes for effectively managing multimedia content to create an organized web site in TYPO3

Arrow left icon
Product type Paperback
Published in Feb 2010
Publisher Packt
ISBN-13 9781847198488
Length 228 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Toc

Table of Contents (13) Chapters Close

TYPO3 4.3 Multimedia Cookbook
Credits
About the Author
About the Reviewers
1. Preface
1. Getting Started 2. Managing Digital Assets FREE CHAPTER 3. Operating with Metadata in Media Files 4. Rendering Images 5. Rendering Video and Audio 6. Connecting to External APIs 7. Creating Services 8. Automating Processes

Setting up a multithreaded environment


TYPO3 is an enterprise content management system, so it is thread safe—meaning two instances of the script can be executed simultaneously, and they will run in parallel without interfering with each other. Therefore, Apache can be set up with mod_fcgid and PHP processes will be allowed to run in parallel.

Note

This setup is not recommended if you have a server with only one or two core processor.

How to do it...

  1. 1. Install components of the server:

    Shell> apt-get install libapache2-mod-fcgid apache2-mpm-worker php5-cgi Shell> a2enmod actions Shell> a2enmod fcgid
    
  2. 2. Replace contents of /etc/apache2/mods-available/fcgid.conf with:

    <IfModule mod_fcgid.c> AddHandler fcgid-script .fcgi SocketPath /var/lib/apache2/fcgid/sock IPCConnectTimeout 60 IPCCommTimeout 256 BusyTimeout 256 ProcessLifeTime 256 </IfModule>
    
  3. 3. Modify site configuration, by default located in /etc/apache2/sites-available/default

  4. 4. Add the following to the virtual host definition:

    Alias /fcgi-bin/ /var/www/fcgi-bin.d/
    Action php-fcgi /fcgi-bin/php-fcgi-wrapper
    
  5. 5. Add the following lines to the directory definition for /var/www/:

    AddHandler fcgid-script .php
    FCGIWrapper /usr/bin/php-cgi .php
    
  6. 6. While there, modify the Options, adding +ExecCGI. Your final site configuration should look like this:

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost
    Alias /fcgi-bin/ /var/www/fcgi-bin.d/
    Action php-fcgi /fcgi-bin/php-fcgi-wrapper
    DocumentRoot /var/www/
    <Directory /var/www/>
    AddHandler fcgid-script .php
    FCGIWrapper /usr/bin/php-cgi .php
    Options Indexes FollowSymLinks MultiViews +ExecCGI
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>
    </VirtualHost>
    

    Note

    Refer to the Apache manual for descriptions of some of the options listed above, as well as other configuration options.

  7. 7. Create the executable link to PHP CGI module:

    Shell> mkdir /var/www/fcgi-bin.d Shell> ln s /usr/bin/php5-cgi /var/www/fcgi-bin.d/php-fcgi-wrapper
    

How it works...

apache2-mpm-worker package, downloaded in the first command line call, is designed to run several threads simultaneously. PHP CGI binary is installed in the same statement.

We then enable the fcgid Apache module, and adjust its configuration. Most installations need to increase the timeout; otherwise, you will be looking at an Internal Server Error if the page rendering takes too long. To further complicate the diagnosis, timeouts are not recorded in logs. We increase the values of IPCConnectTimeout, IPCCommTimeout, and BusyTimeout, along with the ProcessLifeTime. Depending on your configuration, you may need to increase these values further.

Now, when a request comes in to Apache, the PHP CGI process will be launched to handle it. With multiple simultaneous requests, multiple processes will be launched, and run parallel to each other, handling individual requests.

Note

If you have multiple clients using this server, they can have separate PHP processes, and not interfere with each other (for security purposes). You can find more information on configuring this set up at http://typo3.org/development/articles/using-php-with-mod-fcgid/.

See also

  • Creating a scalable architecture

  • Setting up an NFS share

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image