Wp-Cache-Config

Мод «Механизм» для Farming Simulator 2015

Мод Механизм – это наследник уже известного мода Rotator. Данный мод достаточно оптимизирован. И вся анимация происходит за счет игрового движка, а скрипт является лишь их запуском для Farming Simulator 2015. Что делает данный мод спросите вы?

Характеристики скрипта Механизм:

  • Добавление анимации объектов вращения. Теперь валы, шкивы, вентилятор и другое будут иметь свою анимацию. Скорость их работы в некоторых случаях напрямую зависит от скорости оборотов двигателя.
  • Вибрация и другие сопоставляющие эффекты так же будут реализованы с анимацией.
  • Динамические объекты типа дверей, окон и т.д. будут тоже анимированы.
  • Циркулирующие объекты типа дворников и других тоже анимированы.

Полное описание, а также инструкция по установке данного мода, находится в архиве!

WordPress.org

Support » Plugin: WP Super Cache » Can’t enable caching in WP Super Cache

Can’t enable caching in WP Super Cache

I’m having problem enable caching with WP Super Cache. Currently running WordPress freshly installed for testing. The only thing I’ve done is installed WP Super Cache and removed Akismet and Hello Dolly.

The plugin activates, but I can’t enable caching in settings. When I reload the settings page it says “Caching Off” again.

For some reason, it also keeps creating copies of wp-cache-config.php in wp-content, and copies of wp-config.php in the webroot. All these copies gets named a random number like 8734852931.php

A message in WP first says it has added
define( ‘WP_CACHE’, true );
to wp-config.php, but it didn’t. When I add it manually (above require_once(ABSPATH . ‘wp-settings.php’);) i get another message:

Warning! WP Super Cache caching was broken but has been fixed! The script advanced-cache.php could not load wp-cache-phase1.php. The file /home/X/public_html/wp-content/advanced-cache.php has been recreated and WPCACHEHOME fixed in your wp-config.php. Reload to hide this message.

Reloading doesn’t hide it and WPCACHEHOME is not put into wp-config.php. If I manually add
define(‘WPCACHEHOME’, ‘/home/X/public_html/wp-content/plugins/wp-super-cache/’);
to wp-config.php the message goes away, but cache still wont turn on.

Apache error log says nothing of interest, even on debug level.

I’ve tried to do it all over again with chmod 777 on the entire webroot with the same results, so I don’t think it’s permissions. I’ve also tried different PHP (running 5.6 now) and WordPress versions. There are people running exactly the same server setup as me, who has WP Super Cache running on their sites.

Anyone with an idea on what might be the issue here?

scorchp, did you ever get this resolved? I think I might be having the same issues. But I’m very clueless on how to fix it. The following is what I get when I try to do anything with WP Super Cache:

Warning! Could not update /homepages/9/d666075032/htdocs/app666076233/wp-config.php! WPCACHEHOME must be set in config file.
Warning! /homepages/9/d666075032/htdocs/app666076233/wp-content/advanced-cache.php does not exist or cannot be updated.
1. If it already exists, please delete the file first.
2. Make /homepages/9/d666075032/htdocs/app666076233/wp-content writable using the chmod command through your ftp or server software. (chmod 777 /homepages/9/d666075032/htdocs/app666076233/wp-content) and refresh this page. This is only a temporary measure and you’ll have to make it read only afterwards again. (Change 777 to 755 in the previous command)
3. Refresh this page to update /homepages/9/d666075032/htdocs/app666076233/wp-content/advanced-cache.php
If that doesn’t work, make sure the file /homepages/9/d666075032/htdocs/app666076233/wp-content/advanced-cache.php doesn’t exist:
1. Open /homepages/9/d666075032/htdocs/app666076233/wp-content/plugins/wp-super-cache/advanced-cache.php in a text editor.
2. Change the text CACHEHOME to /homepages/9/d666075032/htdocs/app666076233/wp-content/plugins/wp-super-cache/
3. Save the file and copy it to /homepages/9/d666075032/htdocs/app666076233/wp-content/advanced-cache.php and refresh this page.

And I have no clue of where to go or what to do.

Yes and no, meaning I’m on to it but I haven’t had the time to dig deeper due to other emergencies at work.

The problem is a disabled function in php.ini, I just don’t know which one yet. If I remove everything from “disabled_functions” the cache works fine.

Feel free to try it out yourself if it works for you too. It is one of these 😀
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,ln,cat,popen,pclose,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,dl,passthru,shell_exec,proc_close,proc_get_status,proc_nice,proc_open,escapeshellcmd,escapeshellarg,show_source,posix_mkfifo,mysql_list_dbs,get_current_user,getmyuid,pconnect,link,symlink,pcntl_exec,ini_alter,pfsockopen,leak,apache_child_terminate,posix_kill,posix_setpgid,posix_setsid,posix_setuid,proc_terminate,syslog,fpassthru,socket_select,socket_create,socket_create_listen,socket_create_pair,socket_listen,socket_accept,socket_bind,socket_strerror,pcntl_fork,pcntl_signal,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,openlog,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,virtual,file_upload,delete,deleted,edit,cmd,rename,mv,cp,pico,

Something Odd!

WP Super Cache is a full page caching plugin for WordPress that can dramatically speed up blogs.

The plugin is very flexible and can be configured or modified with the aid of filters, actions and the configuration file to handle many situations.

The plugin operates in two modes. Simple and Expert. In both modes, cached static files for anonymous users are generated in the same way in the supercache cache folder (usually wp-content/cache/supercache/). They differ in how the files are served. In Simple mode a small part of WordPress is loaded and PHP runs to check the visitor is anonymous (doesn’t have any login/comment/other cookies). It looks for a cached page and serves it to the visitor if found.
In Expert mode mod_rewrite is used to serve cached files. It does the same checks on cookies and if a cached page is available that will be served to the visitor. It’s marginally faster than using PHP to serve cache files but it’s harder to get working. I recommend using Simple mode.

If you have “Cache HTTP headers with page content” enabled, or a visitor is logged in or left a comment their visit will be cached in a non-anonymous cache file. This file will have visitor specific information in it so it will only be served to the same visitor if they return to that page again. This makes caching for these types of users very inefficient and is the reason there’s a “Don’t cache pages for known users” setting.
In this mode, the cache files are created in the same folders as the other cache files using a filename created from an md5 of the current url, gzip encoding status and the user’s cookies. The mobile user agent may also be added if that’s switched on. The filename may finally be filtered using the “wp_cache_key” filter as explained below.

Configuration

The configuration file is WP_CONTENT_DIR/wp-cache-config.php (usually wp-content/wp-cache-config.php). The configuration is stored in a file because the plugin loads before the database library is loaded. You can modify or add to the configuration file using wp_cache_setting() or wp_cache_replace_line() . Using wp_cache_setting() is preferred.

wp_cache_setting( $setting, $value )

Parameters:
$setting is the name of the setting to be updated.
$value is the value of the setting.
Example:

wp_cache_replace_line($old, $new, $my_file)

Parameters:
$old is a regular expression matching an existing line in the file.
$new is the new line to replace or be inserted.
$my_file is the actual file.
Example:

WP Super Cache has it’s own plugins folder. It needs this to make it easier to extend as it loads before regular WordPress plugins. These plugins are loaded before the database library, or almost all the regular WordPress include files are loaded. They won’t have access to WordPress features like $wpdb, add_action() or add_filter() when they load.

The plugin folder normally lives in wp-super-cache/plugins/ but by modifying the $wp_cache_plugins_dir variable in the config file you can put it anywhere. That’s a good idea if you develop your own supercache plugins because WordPress will delete the folder wp-super-cache and everything in it when upgrading the plugin.

From version 1.6.3 of WP Super Cache you can use two functions to add or remove plugins from loading:

  1. wpsc_add_plugin ( $filename )
  2. wpsc_delete_plugin ( $filename )

The files you add can live anywhere on your host where PHP can load them.

You can also put plugin files in a wp-super-cache-plugins directory in the same directory where the wp-super-cache directory lives. See #574 for more information.

Plugins can interact with the early initialisation process using the “cacheaction” functions. add_cacheaction() and do_cacheaction() work exactly like their WordPress equivalents.

add_cacheaction( $action, $func )

Parameters:
$action is the hook to add an action on.
$func is the function to run when the specified hook or action is executed.

do_cacheaction( $action, $value )

Parameters:
$action is the hook to execute.
$value is the variable to pass to functions that will execute on this hook.

It will return $value.

This will execute any functions added to the ‘wp_cache_get_cookies_values’ hook, and pass $string to each of them.

Two Supercache plugins are included already:

  1. badbehaviour.php provides half-on support for the Bad Behavior anti spam plugin.
  2. searchengine.php provides support for my No Adverts for Friends plugin.

Cacheaction hooks

The following are the cacheaction hooks already defined in WP Super Cache and brief description.

  1. wp_cache_key filters the cache key used to index half-on cache files.
  2. wp_cache_served_cache_file filters the filename of the half-on cache file for the current url.
  3. wp_cache_get_cookies_values filters the cookie string identifying the current visitor.
  4. cache_admin_page allows you to add new content to the WP Super Cache admin page. Use this in your own plugin to add an on/off switch for it on the admin page. See the existing plugins for an example.
  5. add_cacheaction is fired after regular actions are added in wp-cache-phase2.php. Use this cacheaction to execute a function that adds new actions to regular WordPress actions or filters.

Moving things around

You can tell the plugin where various important directories sit:

  1. Define WPCACHEHOME in your wp-config.php to point at where the wp-cache-phase1.php and associated files live. This is usually wp-content/plugins/wp-super-cache/
  2. Point $wp_cache_plugins_dir (in wp-cache-config.php) where you want the WP Super Cache plugins folder to live. See “Plugins” section above.
  3. Set $cache_path (in wp-cache-config.php) to where the cache directory should live.

Late Initialisation

If you’re writing a WordPress plugin that needs to modify the cache key used by WP Super Cache but also needs access to the database use this feature.

Set $wp_super_cache_late_init to 1 in your cache config file.

This will cause the plugin to delay setting the cache key until the “init” hook in WordPress executes. It has a really low priority of 9999 so it’s likely to run after any other hooks. This may cause problems with plugins that use this hook to start an output buffer. Consider yourself warned!
The plugin will also enter half-on mode. Now you can modify the cache key using a hook on wp_cache_key and interrogate the database too.

Garbage Collection

Garbage collection is the process of cleaning up stale or obsolete cache files. The garbage collection(GC) process fires off the wp_cache_gc scheduled event in WordPress. This fires off an action of the same that runs the function wp_cache_gc_cron() .

If for some reason the GC process doesn’t run, you can set $wp_cache_shutdown_gc to 1 in the config file so it will execute at the end of each request instead. (It won’t do an actual cleaning up of cache files on each request.) This will result in a slow down so it’s better to fix your wp-cron system instead.

Clearing the Cache

You can clear the cache by calling the function wp_cache_clear_cache().

Delete the cache files for a single post by using the wp_cache_post_change( $post_id ) function. It will attempt to delete every half-on cache file for that post, as well as any supercache files.
You may need to set the global variable $super_cache_enabled to make this function clean out supercached files. In requests that have GET parameters supercache is disabled so only wp-cache cache files are created, and likewise deleted. Use this code to set that variable before your call the post change function:

It’s possible to filter a number of useful items during the caching process:

  1. do_createsupercache takes the cookie values as a parameter and decides if supercache files should be created or not. Probably of limited use.
  2. supercache_dir filters the supercache directory. 1 parameter, the supercache directory above the directory “supercache”. For example, this page would be “ocaoimh.ie/wp-super-cache-developers”.
  3. wpsupercache_404 returns false by default but have it return true to cache 404 pages.
  4. wpsupercache_buffer filters the content of the page. If your plugin uses an output buffer you could use this filter instead. (Yes, this could be super useful!)
  5. wp_cache_meta filters the meta array stored alongside half-on cache files.
  6. cached_mobile_browsers filters the list of mobile browsers. Load the settings page to activate.
  7. cached_mobile_prefixes filters the list of mobile browser prefixes. Load the settings page to activate.
  8. cached_mobile_groups filters the list of mobile browser groups. Load the settings page to activate.
  9. wp_super_cache_error_checking will allow you to add extra error checking before the plugin settings page loads. Your filter should print a warning message and return false to stop the settings page loading.

I think the most useful filter there could be wpsupercache_buffer. With it, you can examine and modify the page before it’s served and cached. Any plugin that depends on an output buffer could use this instead (and avoid any potential ob conflicts!)
The three mobile filters are only useful if you have mobile support switched on. Please see wp_cache_check_mobile() and wp_cache_mobile_group() in wp-cache-phase1.php for how they work.

Do not cache this page

Define the constant DONOTCACHEPAGE at any time before the current request finishes and the current page won’t be cached.

Modifying Headers

The plugin sends a Vary header and a Cache Control header on every page load. I do not recommend changing the Vary header but if you want to and understand the consequences of doing so, define the constant “WPSC_VARY_HEADER” in wp-config.php to be the value of the new header. For example:

In a similar manner, you can define the constant “WPSC_CACHE_CONTROL_HEADER” to change the Cache Control header.

RuslanY Blog

Speed up WordPress on IIS 7.0

Since the time this article has been written the WP Super Cache plugin has changed a lot. I cannot guarantee at this point that the instructions below will work. Note that new caching plugins have been developed that support IIS better. I recommend to try out W3 Total Cache plugin which has support for IIS and WinCache.

The performance of WordPress may be sufficient for an average blog that gets a few page hits per minute. However, if your blog post suddenly shows up on digg.com or any other social networking site, it may become challenging for server to handle such huge spike in traffic. A few options exist to help server to cope with flood of requests:

  • IIS Output Caching
  • WP Cache plugin for WordPress
  • WP Super Cache plugin for WordPress

In this post I will explain the benefits and drawbacks of each option and walk through the steps for configuring IIS and WordPress to use those options.

Prerequisites

Before performing the configuration steps described in this post, it is necessary to complete the following prerequisites:

  1. Install WordPress (Follow the instructions in this article or use the instructions from the official WordPress site).
  2. Install Microsoft URL Rewrite Module 1.1 for IIS 7
  3. Enable “Pretty Permalinks” in WordPress by following steps described in this article.

IIS Output Caching

IIS 7.0 has a very powerful output caching infrastructure, which can cache response data in kernel-mode (http.sys) and in user-mode memory space (IIS worker process). The Output Caching can be used with static web resources as well as with semi-dynamic web applications, where the content is generated dynamically, but is not likely to change from request to request. A blog engine is a perfect example of semi-dynamic web application.

To enable IIS Output Caching for WordPress you can use IIS Manager UI:

Or add this configuration section into the web.config file located at the root folder of the WordPress site:

With this configuration IIS will cache the response generated by WordPress in memory for 30 seconds, thus avoiding heavy script processing and database I/O for all subsequent requests. This would increase the throughput significantly – for example on my Virtual PC the WordPress throughput grew from 10 requests per seconds to more than 2500 requests per seconds after enabling Output Caching.

However, there are certain drawbacks from using Output Caching. Some of the dynamic blog features are lost when cached page is served instead of a page generated by WordPress. For example, when a visitor submits a comment for a blog post there will be no confirmation message shown to indicate that the comment has been submitted. This is because the page shown to the user after comment submission is served from cache. This may cause visitor to submit same comment several times. This problem can be somewhat mitigated by reducing the cache timeout, but there is still a chance that stale page may be served to a visitor after comment submission. To reliable prevent this from happening a more customized solution for WordPress is necessary, which is a WP Super Cache plugin.

WP Cache and WP Super Cache

WP Super Cache is a very popular plugin that generates temporary static html pages from dynamic WordPress blog. After a html file is generated the server will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP script. Since this is a WordPress-customized solution, it is able to smartly handle such situations such submission of comments or serving pages to logged on users. Specifically, the plug in will serve static html pages only to:

  1. Users who are not logged in
  2. Users who have not left a comment
  3. Or users who have not viewed a password protected post.

Typically 99% of the visitors do not do any of the above actions, so the static html pages will be served most of the time, thus increasing server throughput significantly.

WP Super Cache plugin has two modes of operation: WP-Cache and WP-SuperCache. With WP-Cache the static files are still generated but every request will require loading of PHP engine to serve those files. WP-SuperCache relies on URL rewriting to bypass PHP altogether when serving cached static files.

To configure WP Super Cache on IIS 7.0 follow these steps:

Step 0: Make sure that wp-content folder is writable by web server

Step 1: Download the WP Super Cache plugin and unpack it into the WordPress plugins folder “wp-content\plugins”. This will create “wp-content\plugins\wp-super-cache” folder.

Step 2: Copy the file “wp-content\plugins\wp-super-cache\wp-cache-phase1.php” to “wp-content\advanced-cache.php”

Step 3: Add the following rewrite rule to the web.config file located at the root folder of WordPress site. Make sure that the “WP Super Cache” rule is before the WordPress rule for pretty permalinks. Typically the section will look as below

Step 4: Add the following line into the wp-config.php file above the “require_once(ABSPATH.’wp-settings.php’);” line:

Step 5: Login to WordPress and activate the plugin by going to “Plugins” tab. Then go to “Settings” tab and click on “WP Super Cache”. If everything was configured correctly you should see the plugin’s configuration page.

Step 6: Go to “wp-content\cache” folder, which should have been created when plugin was activated. Create a new web.config file there, open it and paste the following content inside:

This configures IIS to send Cache-Control response header for any of the cached html pages. That header will force the browser to expire the locally cached response after 5 minutes.

To check that the WP Super Cache actually works, set its status to ON in the plugin configuration page, then clear all the browser cookies and make a request to the blog page. Alternatively you can use WFetch to make a request. If WP Super Cache works then when you make a request to http://wordpress/2008/04/hello-world/, the response will be cached as a static file in \wp-content\cache\supercache\wordpress\2008\04\hello-world\index.html. When next time you request the same page, the rewrite rule “WP Super Cache” will rewrite the URL to the “wp-content\cache\supercache” folder, thus IIS will serve static html file without even invoking PHP engine.

Conclusion

Here is the comparison of server throughput in requests per second with three output caching solutions for WordPress when requesting http://wordpress/2008/04/hello-world:

The performance of WP Super Cache is comparable with performance of IIS Output Caching because with WP Super Cache IIS is just serving static files, which is what IIS is very good at.

So, when to use which option? Here are the pros and cons of each caching solution:

LEAVE A REPLY

Your email address will not be published. Required fields are marked *