Score:0

How to install memcashed on a LAMP stack with PHP FPM?

in flag

I have a LAMP stack with PHP FPM and multiple virtual hosts with Wordpress sites on.

I have tried to install memcashed using this tutorial.

In Wordpress sitehealth I get: "You should use a persistent object cache".

In /etc/memcached.conf I have:

-l my IP address
-l ::1

I have set this ufv rule:

sudo ufw allow from client_system_private_IP/32 to any port 11211

In /var/log/apache2/error.log I get:

Got error 'PHP message: PHP Fatal error:  Cannot redeclare wp_cache_add() (previously declared in...

EDIT:

I just found this.

It appears that:

The function is defined in two separate files or

The function is defined in two places in the same file

And can be fixed by using include_once instead of include when including my PHP file.

Now I just need to figure how to do so?

How to enable memcached on Wordpress?

Score:0
us flag

The error you are seeing is not related to your memcached installation at all.

There is something wrong with your WordPress installation. Maybe you have installed/activated two separate cache plugins, and therefore the function is defined twice.

Without further information of your WordPress installation, I cannot give any more detailed answer.

newcat1000 avatar
in flag
Hi Tero, thanks for your answer. I have WP-Optimize installed. I just deactivated it without luck. I just deactivated all plugins without luck. I have 9 virtual hosts on 1 droplet. What information do you need? Thanks!
us flag
The error log message tells where the function is declared and re-declared. You need to check the files and to which entity they belong.
newcat1000 avatar
in flag
The error described earlier is outdated, it came from a plugin I already have deleted. Sorry. I get this error in /var/log/apache2/error.log: AH01630: client denied by server configuration: /var/www/html/example.net/public_html/wp-content/uploads/code-execution.php, referer: https://www.example.net/wp-content/uploads/code-execution.php
us flag
You should not have PHP files in your `uploads` directory. Now you need to find out why there is such a file in your `uploads` directory. Also, that isn't likely related to memcache in any way.
newcat1000 avatar
in flag
Thanks! Here is another error: AH01071: Got error 'PHP message: [ERROR] : WP_CACHE constant is not present in wp-config.phpPHP message: [ERROR] : WP_CACHE constant is not present in wp-config.phpPHP message: [ERROR] : WP_CACHE constant is not present in wp-config.php', referer: https://www.example.net/wp-admin/plugins.php
newcat1000 avatar
in flag
Last error: AH01276: Cannot serve directory /var/www/html/example.net/public_html/indexing-test/: No matching DirectoryIndex (index.php,index.html,index.cgi,index.pl,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive, referer: https://www.example.net/indexing-test/
newcat1000 avatar
in flag
There is this: <?php /** * Test file for Really Simple SSL to check if uploads directory has code execution permissions * */ echo "RSSSL CODE EXECUTION MARKER";
newcat1000 avatar
in flag
Its from Really Simple SSL WP plugin
newcat1000 avatar
in flag
I just deleted the file in example.net/wp-content/uploads/code-execution.php and still get the 'You should use a persistent object cache' on WP site health.
us flag
Did you add the caching directives for WordPress?
newcat1000 avatar
in flag
I have tried different plugins like Object Cache, the site crashes when I enable them. I have tried to clean up wp-config.php and .htaccess without luck.
newcat1000 avatar
in flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/141055/discussion-between-newcat1000-and-tero-kilkanen).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.