Litespeed and eAccelerator on Mac OS X

Discussion in 'PHP' started by Justin, Apr 19, 2006.

  1. Justin

    Justin New Member

    I've installed Litespeed Standard 2.1.14 on a test iBook running Mac OS X 10.4.5 (PPC), and for the most part it appears to function. There are a few gotchas I've come across, which I'll explain below as I document the process.

    - Install wget, which is required by the installer but is not on OS X by default
    $ sudo port install wget
    - Download and install Litespeed
    $ tar xzf lsws-2.1.14-std-ppc-osx.tar.gz
    $ cd lsws-2.1.14
    $ sudo ./
    - Answers to relevant install-time questions
    Destination [/opt/lsws]: /usr/local/litespeed
    User [nobody]: www
    Group [nobody]: www
    HTTP port [8088]: 80
    Admin HTTP port [7080]: 9007
    Setup up PHP [Y/n]: Y
    Suffix for PHP script(comma separated list) [php]:
    Would you like to change PHP opcode cache setting [y/N]? N
    Would you like to install AWStats Add-on module [y/N]? Y
    Would you like to import Apache configuration [y/N]? N
    Would you like to have LiteSpeed Web Server started automatically when the machine restarts [Y/n]? N
    Would you like to start it right now [Y/n]? Y
    After installation was complete, I was able to test the built-in PHP module via:


    I did some benchmark testing via Apache Bench on the above URL but was only able to get about 68 requests per second. I used the command line tool to turn the APC cache tool on and off, but it did not appear to make a difference.

    I decided to try some of the other caching tools, but ran into several problems. With mmcache, for example, the download link from the download page...

    ...results in a 404 "File Not Found" error (just click the above link and you'll see what I mean).

    Okay, so much for mmcache. Let's try eAccelerator. I run and select item #3 (eAccelerator), and the following is the output.

               => `eaccelerator-php-4.4.2-ppc-osx.tar.gz'
    Resolving [url][/url]...
    Connecting to||:80... connected.
    HTTP request sent, awaiting response... 404 Not Found
    12:34:12 ERROR 404: Not Found.
    [WARN] Can not retrieve binary package for eaccelerator from [url][/url], 
           please download it manually from 
           or build binary from source code.
           Please make a symbolic link from to
    Whoa. eAccelerator is at version 4.4.2? No, it's currently at 0.9.4. It looks like some copying-and-pasting went on when the script was written, and all that was changed for eAccelerator was the name (thus it having the same version number as mmcache).

    I tried compiling eAccelerator manually via the following steps and then selecting it via, but doing so broke PHP completely, and I had to revert to APC.
    $ tar xzf eaccelerator-0.9.4.tar.bz2
    $ cd eaccelerator-0.9.4
    $ sudo /usr/bin/phpize
    $ ./configure --enable-accelerator=shared --with-php-config=/usr/bin/php-config --with-eaccelerator-userid=www
    $ make
    $ sudo make install
    $ sudo cp /usr/lib/php/extensions/no-debug-non-zts-20020429/ /usr/local/litespeed/lib/
    $ cd admin/misc
    $ sudo ./
    Any suggestions as to how I can eAccelerator installed and working with Litespeed and the PHP LSAPI module?

    Thank you!

  2. Justin

    Justin New Member

    Any suggestions?

    We would like to deploy Litespeed instead of Lighttpd or Apache, but that unfortunately won't be an option if we can't get Litespeed to play nicely with eAccelerator.

    Xing? Mistwang? Anybody have any suggestions as to how we might get Litespeed working on Mac OS X with the leading PHP opcode accelerators? I tried above to provide as much detail as possible, but if you need additional information to help troubleshoot the problem, by all means please let me know.

    Looking forward to your suggestions! :)
  3. xing

    xing LiteSpeed Staff

    Justin, sorry for the late reply. Schedule off wack.

    First off, the pre-configured install options for PHP opcode caches are a bit update and looking forward, we would likely remove all both mmcache and eacc and default to APC 3.0 in the near future. One reason is that APC is simply the most well developed product at the moment backed several key PHP developers.

    I would highly recommend you to use the latest APC opcode module from . Try that with OS X. You will have to install the developer tools on your ibook to get gcc/compiler packages. You will have to compile and install it yourself.

    From my personal experience with APC, which has had major stability upgrades the past 6 months, is now the defacto PHP opcode cache module to beat. Zend is non-free so we can ignore them.

    LiteSpeed does have a 24/7 live OS X (Intel) server testing our software non-stop so I will try to install PHP and APC on it tonight to see it how it goes. I don't see any potential problems.

    Lastly, you are probably curious why I recommend APC over eAcc. The answer is pretty simple, I started on eAcc and have always had php segfaults, though at a very small volume, per day. Since the move to APC, 3.0 branch I have not had a single problem with the opcode cache. Our in-house LiteSpeed test machines gets tested very hard 24/7 with live traffic as we have agreement with a few websites so based on that, I'm sold on APC 3.0.
  4. xing

    xing LiteSpeed Staff

  5. xing

    xing LiteSpeed Staff

    Try this:

    APC 3.0.10 on OS X (intel)

    1) download/expand PHP 5.1.2

    2) cd into php-5.1.2/sapi

    3) download and expand l into the "sapi" folder of php source.

    4) in php source directory, do

    touch ac*
    ./buildconf --force
    5) Configure/Compile php

    './configure' '--prefix=/xingwww/php5' '--with-litespeed' '--with-config-file-path=../conf'
    make install
    6) Replace the lsphp binary (backup first) in /lswsinstall/fcgi-bin/lsphp with

    7) Download/Expand APC from . In APC source dir do:

    ./configure --enable-apc--mmap --with-php-config=/xingwww/php5/bin/php-config
    make install
    Using --enable-apc --enable-apc-shm will give errors on os x.

    8) Configure /lswsinstall/conf/php.ini

    include_path = ".:/xingwww/php5"
    ;extension_dir = ./
    Setting above size=4 (4MB) gives errors right now. Also make sure that extension_dir is commented out.

    9) Critical for OS X. By default, OS X kernel does not allow shared memory segments over 4MB. So right now, wil fail to load with some "can't load null" error.

    edit or make /etc/sysctl.conf if doesn't exist already with following values:

    10) Reboot to get the kernel sysctl values updated and enjoy APC on OS X with LiteSpeed PHP LSAPI. =)

    That's it.
  6. Justin

    Justin New Member

    Thank you!

    Thank you for the detailed responses! They were very helpful.

    I'm not sure where in the php.ini file you are referring to here, so I made no changes other than the three lines you explicitly mentioned.

    I have Litespeed running with APC 3.0.10, and running the "siege" load test tool locally for 30 seconds on phpinfo.php on a dual 1.0 GHz G4 Xserve produces the following results:
    $ siege --concurrent=10 --time=30S --delay=0 --url=http://localhost/phpinfo.php
    Transactions:                   5775 hits
    Availability:                 100.00 %
    Elapsed time:                  30.25 secs
    Data transferred:          172615343 bytes
    Response time:                  0.05 secs
    Transaction rate:             190.91 trans/sec
    Throughput:               5706292.50 bytes/sec
    Concurrency:                    9.94
    Successful transactions:        5775
    Failed transactions:               0
    Longest transaction:            0.27
    Shortest transaction:           0.01
    I have no idea whether the above results are indicative of typical performance with Litespeed+APC on the above-mentioned class of hardware; perhaps you can take a look and let me know what you think.

    The next step is getting Rails running on Litespeed via the Ruby LSAPI module (as opposed to fastcgi). If you could possibly test Rails via the Ruby LSAPI on your MacTel server and document the steps as you did above and post them in the new thread I created, I imagine you will have a number of very grateful folks (including me!) :D

    Thanks again for all of your help!


Share This Page