Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 661035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:13:26+00:00 2026-05-13T23:13:26+00:00

I want to start using memcache with PHP (on Ubuntu 9.10). There are lots

  • 0

I want to start using memcache with PHP (on Ubuntu 9.10). There are lots of info online which appear to show how to do this. Suprisingly though, none of the articles (I have seen so far), explicitly state whether you need to RUN the memcache process BEFORE attempting to use it or whether by simply calling new MemCache() via the PHP client library, a process will be spawned (if not already running).

From the various docs I have read on this so far, these are the steps that I think make sense:

  1. Install memcache on your machine (there are several docs showing how to do this)
  2. Modify your php.ini file and set the memcache related consts/flags to the values that make sense for your environment
  3. Create an init script in ini.d to start memcache as a daemon
  4. Restart Apache daemon

Number 3 is the part that I need confirmation on, because none of the docs I have seen so far mentions the lifespan of the memcache process.

Can someone experienced in this confirm if this is the correct steps?
Also if I have missed a step, let me know.

As an aside, since I am relatively new to Linux, I would be grateful if someone could post an example of an init script that would be needed to run the memcache daemon process (assuming that the steps I have outlined above are correct)

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:13:26+00:00Added an answer on May 13, 2026 at 11:13 pm

    memcached and Apache+PHP are two totally unrelated things, at first. The only thing is PHP is connecting to the memcached daemon.

    So, yes, memcached (note the ‘d‘ at the end) must be started before you try using it : it you try connecting to a memcached server when it’s not running, you just won’t be able to connect — it won’t spawn a new daemon nor anything.

    Using a simple comparison : it your Apache server is not started and you try to access to it using your browser, you’ll get a “cannot connect” error ; it’s exactly the same with PHP trying to connect to memcached : it will not be able to.

    Now, for the installation process, here are a couple of notes, for the parts that don’t look OK in what you said :

    • Install memcached on your machine
      • If you installed in using your distribution mecanism, it should have created the script in /etc/init.d/
      • And it should have started the daemon
      • As a reminder, to install something with Ubuntu, you should use apt-get install memcached or aptitude install memcached
    • Before modifying your php.ini, you must install the memcache extension for PHP — so PHP has functions to connect to memcached.
      • This can be done using the php5-memcache package of your distribution
      • Or with the pecl install memcache command, which will download the sources from pecl.php.net and compile them — which means you’ll need everything that’s needed to compile software.

    Edit : easier to answer here than in a comment

    I said installing memcached should be OK — on Ubuntu, it seems there is a trap :

    Using this :

    ps -Alf | grep memcached
    

    I don’t see any running daemon.

    And when I try to start the daemon, I get the following:

    $ sudo /etc/init.d/memcached start
    Starting memcached: memcached disabled in /etc/default/memcached.
    

    So, on Ubuntu, you have to edit /etc/default/memcached, and change it ; instead of this :

    # Set this to yes to enable memcached.
    ENABLE_MEMCACHED=no
    

    It should contain that :

    # Set this to yes to enable memcached.
    ENABLE_MEMCACHED=yes
    

    Then, starting memcached should be possible :

    $ sudo /etc/init.d/memcached start
    Starting memcached: memcached.
    test@tests: ~/temp
    $ ps -Alf | grep mem
    4 S nobody    3813     1  0  80   0 - 30025 ep_pol 00:17 pts/4    00:00:00 /usr/bin/memcached -m 64 -p 11211 -u nobody -l 127.0.0.1
    0 R test      3819  2690  0  80   0 -  1834 -      00:17 pts/4    00:00:00 grep --color=auto mem
    

    Note : now that memcached is enabled, it should be started automatically with your system, each time you reboot it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I want to start using virtualenv this year. I like the no-site-packages option,
I want to start using Python for small projects but the fact that a
I want to start using .NET 3.5 features in an app that is currently
I want to start using Nunit (finally), I am using Visual Studio 2008. Is
I'm working with a database and I want to start using LINQ To SQL
I'm just learning how to do things, and want to start using some sort
I want to start learning HTML and AJAX using a Linux distribution. Can anyone
I've been using Winforms since .NET 1.1 and I want to start learning WPF.
I wrote an application server (using python & twisted) and I want to start
I want to start working with TDD but I don't know really where to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.