Posts

Showing posts from June, 2015

Getting PHP FastCgi Process Manager (FPM) and nginx working in cygwin

Despite the popularity of nginx and php, I was surprised that it wasn't easiy to find a working configuration for PHP-FPM (fast cgi) with a nginx server in front, running on cygwin.
Once I had the right fragments of settings, it was a case of systematically trying them all out.

/etc/php5/php-fpm.conf:[global] pid = /var/run/php-fpm.pid ;note: i create a /var/log/php dir owned by the service user/group ;this allows the permissions to be inherited easily on the filesystem error_log = /var/log/php/fpm-global.log ; cygwin user default is 256 rlimit_files = 1024 ;pool configuration, having a pool config per site means you can easily have a separate log file [www] ;they have to be set but the cygwin version ignores them ;user=service-user ;group-service-group ; The address on which to accept FastCGI requests. listen = 127.0.0.1:8001 ; or ; listen = tmp/php-cgi.socket ; for socket unset these: listen.owner=service-user listen.group=service-group ; this allows the process pool to be q…

Remote debugging PHP from phpStorm

Despite all the documentation out there, it seemed to take me longer than it should. Although in hindsight, it could have been working originally as phpStorm's indicator that it's debugging is subtle.

Debug session within phpStorm Two articles to get you started:
phpStorm Help: Configuring XdebugphpStorm Confluence: Xdebug Installation Guide
To setup follow do the following:
For chrome (probably the easiest), install this plugin: Chrome PluginConfigure the plugin and select phpStorm as your IDE.Next sign onto your remote server and enable xdebug modulefor cPanel, click select php version (only 5.4 and 5.5 supported)update versioncheck the xdebug moduleclick updateEdit the php.ini, e.g. for cPanel, edit or create: /home/[username]/public_html/.user.ini
; Settings for xdebug module was already loaded on this machine: ; zend_extension=/opt/alt/php54/usr/lib64/php/modules/xdebug.so xdebug.remote_host=[your modems IP address] xdebug.remote_port=[a port forwarded through your modem …

Good defaults for Wordpress (on a cPanel server)

After spending some time finding problems in a few Wordpress sites, both local in my dev environment and on a cPanel hosted server, I finally decided to sit down and work out the best base settings for each environment. The settings I've picked are mainly around dev and debugging, however I will try and keep this post updated as I come across new settings.

php.ini settings Local Dev These settings can be set in your local dev env php.ini (e.g. in c:\php-installdir\php.ini)
display_errors = On display_startup_errors = On log_errors = On error_log = C:/temp/php-errors.log error_reporting = -1 Production / hosted On cpanel servers, create a file in public_html: ".user.ini" (/home/[user]/public_html/.user.ini). Its without quotes but starting with a dot. Similar contents but limited by what you can set.
display_errors = Off error_log = /home/[user]/logs/php-errors.log error_reporting = -1 Depending on the server you may be able to alternatively use .htaccess (/home/[user]/p…

Plex Framework 2.5.0 Plugin Manifest

I’ve found that the documentation on the website doesn’t tie up with the API that is currently included with Plex. So here’s the bits of data I’ve gleaned.
The plugins & directory structure of Plex is based around OSX / iOS Bundle Structures. Each plugin has an Info.plist file which is based off Apple’s one (the documentation is here) with some extra properties. Some of these are documented on Plex's site but some were missing. This is a near complete list of them all and what I could work out their purpose to be.
Keys for Info.plist taken from core.pyCFBundleIdentifierPlugin namePlexPluginClassType of plugin, default ‘Content’ (but is ‘Channel’ under bundleservices).
Values from constants.py:[‘Content’, ‘Agent’, ‘Channel’, ‘Resource’, ‘System’]PlexPluginTitleThe display namePlexPluginIconResourceNameDefault: 'icon-default.png'PlexPluginArtResourceNameDefault: 'art-default.jpg'PlexPluginTitleBarResourceNameDefault: 'titlebar-default.png'PlexPluginDevMo…