IMHO

The Answers Depend On The Question

NGINX, PHP, PHP-FPM and El Capitan

I do a lot of WordPress development and use nginx as my web server. Since WordPress uses PHP (v5.5.27 is included with El Capitan), I also use PHP-FPM as my FastCGI Process Manager.  Here are some of the issues I needed to resolve to get my development environment up and running.

NGiNX:

  • Disable user setting in nginx.conf. Since I run nginx manually as needed, I needed to comment the user setting.
  • The default log paths in nginx.conf were pointing to paths that did not exist. I wanted the logs to be located in the same parent folder as my html folder so I set them accordingly:
    • error_log /usr/local/var/log/nginx/error.log
    • access_log /usr/local/var/log/nginx/access.log
  • This was a new error I received when attempting to launch nginx in El Capitan: ‘1024 worker_connections exceed open file resource limit: 256’. To resolve this I added the following line in the main section of my nginx.conf file: ‘worker_rlimit_nofile 65535;’. This changes the limit of maximum number of open files for worker processes. http://stackcoded.com/379456/nginx-ulimit-workerconnections-exceed-open-file-resource-limit-1024

MySQL

  • Since El Capitan resets the permissions for all files and folders under /usr, I needed to change the ownership for /usr/local/mysql and all of its files and subfolders to _mysql. sudo chown -R _mysql:_mysql /usr/local/mysql/*

PHP

  • By default, El Capitan does not contain /etc/php.ini. Instead it contains /etc/php.ini.default. I simply copied the php.ini.default to php.ini and made the necessary changes to the file.

PHP-FPM

  • By default, El Capitan does not contain /etc/php-fpm.ini. Instead it contains /etc/php.ini.default. I simply copied the php-fpm.ini.default to php-fpm.ini and made the necessary changes to the file.
  • Like nginx, I prefer to run php-fpm manually as needed. In the php-fpm.ini file I needed to comment out the user and group settings.

As I continue setting up my new development environment in El Capitan I will update this article as I find more obstacles.

Leave a Reply

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