How to configure systemd so that PHP can use memcached unix socket?











up vote
1
down vote

favorite












I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7.



In /etc/memcached.conf I added:



-s /tmp/memcached.sock
-a 666


When I restart the service, I see:



srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-memcached.service-oIF206/tmp/memcached.sock=


How can I configure systemd to know where the unix socket is?










share|improve this question
























  • You have made tests right? Most of the sites written for php 5 breaks in php 7
    – Rui F Ribeiro
    Nov 13 at 5:33












  • @RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
    – Paul
    Nov 13 at 14:01















up vote
1
down vote

favorite












I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7.



In /etc/memcached.conf I added:



-s /tmp/memcached.sock
-a 666


When I restart the service, I see:



srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-memcached.service-oIF206/tmp/memcached.sock=


How can I configure systemd to know where the unix socket is?










share|improve this question
























  • You have made tests right? Most of the sites written for php 5 breaks in php 7
    – Rui F Ribeiro
    Nov 13 at 5:33












  • @RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
    – Paul
    Nov 13 at 14:01













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7.



In /etc/memcached.conf I added:



-s /tmp/memcached.sock
-a 666


When I restart the service, I see:



srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-memcached.service-oIF206/tmp/memcached.sock=


How can I configure systemd to know where the unix socket is?










share|improve this question















I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7.



In /etc/memcached.conf I added:



-s /tmp/memcached.sock
-a 666


When I restart the service, I see:



srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-memcached.service-oIF206/tmp/memcached.sock=


How can I configure systemd to know where the unix socket is?







ubuntu systemd unix-sockets memcached






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago

























asked Nov 13 at 4:07









Paul

1228




1228












  • You have made tests right? Most of the sites written for php 5 breaks in php 7
    – Rui F Ribeiro
    Nov 13 at 5:33












  • @RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
    – Paul
    Nov 13 at 14:01


















  • You have made tests right? Most of the sites written for php 5 breaks in php 7
    – Rui F Ribeiro
    Nov 13 at 5:33












  • @RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
    – Paul
    Nov 13 at 14:01
















You have made tests right? Most of the sites written for php 5 breaks in php 7
– Rui F Ribeiro
Nov 13 at 5:33






You have made tests right? Most of the sites written for php 5 breaks in php 7
– Rui F Ribeiro
Nov 13 at 5:33














@RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
– Paul
Nov 13 at 14:01




@RuiFRibeiro The sites on my server all use popular packages such as WordPress and MediaWiki. I haven't put any of them on the new server until I can verify everything is working, but I haven't even gotten that far as I discovered this issue with unix sockets for memcached.
– Paul
Nov 13 at 14:01










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










systemd has PrivateTmp=true for memcached.service



One way would be to override PrivateTmp, specifically for the memcached.service, i.e.



mkdir -p /etc/systemd/system/memcached.service.d
echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
systemctl daemon-reload
systemctl restart memcached


That would change the memcached.service back to using /tmp, rather than /tmp/systemd-private-...



Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock exists with the correct permissions, in /etc/php.ini or /etc/php/conf.d/memcached.ini change session support.



[Session]
extension=memcached.so
session.save_handler="memcached"
session.save_path="/tmp/memcached.sock"


If it exists, comment out session.save_handler=files.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481372%2fhow-to-configure-systemd-so-that-php-can-use-memcached-unix-socket%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    systemd has PrivateTmp=true for memcached.service



    One way would be to override PrivateTmp, specifically for the memcached.service, i.e.



    mkdir -p /etc/systemd/system/memcached.service.d
    echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
    echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
    systemctl daemon-reload
    systemctl restart memcached


    That would change the memcached.service back to using /tmp, rather than /tmp/systemd-private-...



    Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock exists with the correct permissions, in /etc/php.ini or /etc/php/conf.d/memcached.ini change session support.



    [Session]
    extension=memcached.so
    session.save_handler="memcached"
    session.save_path="/tmp/memcached.sock"


    If it exists, comment out session.save_handler=files.






    share|improve this answer



























      up vote
      2
      down vote



      accepted










      systemd has PrivateTmp=true for memcached.service



      One way would be to override PrivateTmp, specifically for the memcached.service, i.e.



      mkdir -p /etc/systemd/system/memcached.service.d
      echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
      echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
      systemctl daemon-reload
      systemctl restart memcached


      That would change the memcached.service back to using /tmp, rather than /tmp/systemd-private-...



      Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock exists with the correct permissions, in /etc/php.ini or /etc/php/conf.d/memcached.ini change session support.



      [Session]
      extension=memcached.so
      session.save_handler="memcached"
      session.save_path="/tmp/memcached.sock"


      If it exists, comment out session.save_handler=files.






      share|improve this answer

























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        systemd has PrivateTmp=true for memcached.service



        One way would be to override PrivateTmp, specifically for the memcached.service, i.e.



        mkdir -p /etc/systemd/system/memcached.service.d
        echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
        echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
        systemctl daemon-reload
        systemctl restart memcached


        That would change the memcached.service back to using /tmp, rather than /tmp/systemd-private-...



        Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock exists with the correct permissions, in /etc/php.ini or /etc/php/conf.d/memcached.ini change session support.



        [Session]
        extension=memcached.so
        session.save_handler="memcached"
        session.save_path="/tmp/memcached.sock"


        If it exists, comment out session.save_handler=files.






        share|improve this answer














        systemd has PrivateTmp=true for memcached.service



        One way would be to override PrivateTmp, specifically for the memcached.service, i.e.



        mkdir -p /etc/systemd/system/memcached.service.d
        echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf
        echo "PrivateTmp=false" >> /etc/systemd/system/memcached.service.d/override.conf
        systemctl daemon-reload
        systemctl restart memcached


        That would change the memcached.service back to using /tmp, rather than /tmp/systemd-private-...



        Assuming you want to use memcached for session handling; Once you've verified that /tmp/memcahced.sock exists with the correct permissions, in /etc/php.ini or /etc/php/conf.d/memcached.ini change session support.



        [Session]
        extension=memcached.so
        session.save_handler="memcached"
        session.save_path="/tmp/memcached.sock"


        If it exists, comment out session.save_handler=files.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 14 at 14:31

























        answered Nov 13 at 14:59









        Joseph Tingiris

        1636




        1636






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481372%2fhow-to-configure-systemd-so-that-php-can-use-memcached-unix-socket%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Accessing regular linux commands in Huawei's Dopra Linux

            Can't connect RFCOMM socket: Host is down

            Kernel panic - not syncing: Fatal Exception in Interrupt