Understanding Caching in WordPress, Part 2

In the previous post, I shared a basic primer for how database-backed applications – specifically WordPress – work without caching. And before we talk about how basic caching works in WordPress, namely with the Transients API, it’s important to discuss the basic principles of caching. This includes why we do it, its benefits, and how it works. Then… Continue reading Understanding Caching in WordPress, Part 2

Understanding Caching in WordPress, Part 1

Back in may, I wrote an article about using the WordPress Transients API. I summarize the article like this: To simulate cookies and their feature of expiration, using WordPress transients may be a viable solution. https://tommcfarlin.com/using-wordpress-transients/ Though the purpose of the article was to lay out a foundation for how we can design a class to work… Continue reading Understanding Caching in WordPress, Part 1


近日因工作调整,重拾PHP的活,遂启用macbook的开发用途,采用mac自带Apache+PHP搭建本地环境,然发现在macbook自带的Apache+PHP环境中没有开启错误提示,这里提供一个解决方案: 首先,找到的环境中php.ini之所在,修改display_errors和error_reporting两项的值。 找到 display_errors = Off ,把Off 改为 On . 修改后为 display_errors = On ; 找到 error_reporting = E_ALL & ~E_NOTICE 或者error_reporting = E_ALL & ~E_DEPRECATED  改为 error_reporting = E_ALL | E_STRICT 其次,找到环境中的httpd.conf之所在,在文件的最后面加上下面代码以完善相应配置: php_flag display_errors onphp_value error_reporting 2039 相关常识 Mac中的php.ini在哪里? Mac OS X中没有默认的php.ini文件,其对应的模板文件php.ini.default,位于/private/etc/php.ini.default 或者是 /etc/php.ini/default ,可以自行拷贝一份进行修改。 sudo cp /private/etc/php.ini.default /private/etc/php.ini MAC中默认的http.conf在哪里? Mac OS X中的http.conf位于/etc/apache2/httpd.conf。 Apache相关的运行命令: sudo apachectl… Continue reading Mac自带PHP+Apache环境中不显示错误信息的解决


因为工作原因,近期重拾WordPress的相关工作,久未接触,而今发现Jetpack已如此强大,遂至Automattic一探究竟,然能力有限,耗时费力。 本地环境中需要使用Homebrew安装yarn,惯而采用$sudo brew install yarn进行安装,结果提示以下警告信息: Error: Running Homebrew as root is extremely dangerous and no longer supported.As Homebrew does not drop privileges on installation you would be giving all build scripts full access to your system. 错误:以root身份运行Homebrew非常危险,不再受支持。由于Homebrew不会放弃安装特权,因此您需要为所有的构建脚本提供对系统的完全访问权限。 遂改为$ brew install yarn,然后出现如下提示: Error: The following directories are not writable by your user:/usr/local/share/man/man5/usr/local/share/man/man7 并给出了解决方案: 为用户目录赋予相应的权限 确保该用户具备写权限 You… Continue reading 以root身份运行Homebrew非常危险,不再受支持