nono303 / memcached

141 stars 38 forks source link

Failed to install / execute Memcached on Windows Server 2019 #6

Closed marcolungo closed 2 years ago

marcolungo commented 2 years ago

Hi, the issue description, that is gived by Powershell installing Memcached as a service (or executing too) is:

PS C:\memcached> .\memcached.exe -d install 0 [main] memcached (2316) C:\memcached\memcached.exe: ** fatal error - cygheap base mismatch detected - 0xF48408/0xFD8408. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. 0 [main] memcached 1885 dofork: child -1 - forked process 2316 died unexpectedly, retry 0, exit code 0xC0000142, errno 11 failed to daemon() in order to daemonize

image

I've created the directory that it seems it wants, putting in it the .dll, but nothing change.

I didn't have Cygwin installed on my server. It seems to me that, with your stuff, it is not required to do that.

The installation or execution of Memcached.exe does not work, whether you put the .dll under c: / cygwin / bin, or leave everything under c: / memcached.

image

The version used is 1.6.15

My equipment is a Windows Server 2019 Essentials, up to date CPU AMD Ryzen 7 3700X MB MSI Mortar WiFi 32 Gb RAM GSkill

p.s.: I seem to have seen that you also made the .dll or, for what I understand, everything I need then to connect / use Memcached with PHP 8.1, is that right? Could I have some instructions to make it all work together, please? Thanks!

nono303 commented 2 years ago

Hi @marcolungo,

Your cygheap error might be related to this issue related to your system and not to memcached

Otherwise, here are some hints to resolve it.

  1. Target version to use for you:

  2. Dependencies

    • Either you use your Cygwin dll dependencies (considering that /bin Cygwin folder in in your windows %PATH%). It MUST require:

      • The same Cygwin version : actually 3.3.5 check it with uname -a in Cygwin terminal
      • Installed packages:
      • libevent2.1_7
      • openssl (for tls version)
    • Or simply use provided deps: just copy all dll file of libevent-2.1/x64 version into your memcached folder. It will avoid mismatched version between your Cygwin installation and provided one used for build & run

  3. Daemon

    • Concerning your cmd line -d install doesn't exist check it with .\memcached.exe -h | grep -i install it return nothing!

    • you can not install it as a daemon aka windows service and might use nssm to do it. I’ve just provided it and updated readme for instruction

marcolungo commented 2 years ago

Hi Nono, finally I could get back to this problem for me... Happy to say to you that now it works fine, all the instructions works well. A little suggestion: try to create a .bat to be executed as Administrator with all the nssm commands inside. I did that and I think that is useful for all to have a complete "install service" on github. It could be simple to say: "Hi guys, the instrucions are: 1 - Chose the correct version based on (write the right stuff here for the people) 2 - Download and unzip on C:/memcached 3 - Run install_as_service.bat 4 - Be happy.

VERY IMPORTANT: the service do not start if you do not create C:/memcached/logs/memcached.log file. Absolutely, put these instruction on readme and/or directly in the install_as_service.bat as a thing to do before start the service!

Now my problem is: how could I connect to my PHP 8.1.5? What are the next step I have to do? Could you help me, please?

Many thanks for all Marco

nono303 commented 2 years ago

Hi @marcolungo ,

Happy to know that now it works fine for U! I will not provide install_as_service.bat in the repository as readme.md instructions are just an exemple that need to be contextualized, changed or managed by nssm gui. it might imply more ambiguities than facilities

VERY IMPORTANT: the service do not start if you do not create C:/memcached/logs/memcached.log

It's only related to your runtime & right management (service owner, folder owner etc.) On an elevated environment (normal execution mode for windows services) log file is created at service start if it does not exist and if log folder is writable for service owner

how could I connect to my PHP 8.1.5

look at https://github.com/nono303/PHP-memcache-dll ;)