Posts

Cygwin, access control, default groups and just getting it playing nice

correcting current and default permissions If you've been messing with your permissions on copying data across from another NTFS system, some of the owners/groups may be off and the even after correcting the owners and their permissions, any new files don't have the right defaults. This simple script replaces the ACL records for each file and directory, giving the default permissions specified. find $1 -type f -exec setfacl -f facl {} \; find $1 -type d -exec setfacl -f dacl {} \; dacl - directory permissions user::rwx group::rwx other:r-x default:user::rwx default:group::rwx default:other:r-x facl - File Permissions user::rw- group::rw- other:r-- default:user::rw- default:group::rw- default:other:r-- Specifying the default groups for users The documentation for cygwin is in depth but doesn't simply answer the question: How do I set the default group for a user? (in the out of the box configuration). The starting point is the mkpasswd utility. These are the fo...

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 ...

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 Xdebug phpStorm Confluence: Xdebug Installation Guide To setup follow do the following: For chrome (probably the easiest), install this plugin: Chrome Plugin Configure the plugin and select phpStorm as your IDE. Next sign onto your remote server and enable xdebug module for cPanel, click select php version (only 5.4 and 5.5 supported) update version check the xdebug module click update Edit 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 po...

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 .htacces...

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.py CFBundleIdentifier Plugin name PlexPluginClass Type of plugin, default ‘Content’ (but is ‘Channel’ under bundleservices). Values from constants.py:[‘Content’, ‘Agent’, ‘Channel’, ‘Resource’, ‘System’] PlexPluginTitle The display name PlexPluginIconResourceName Default: 'icon-default.png' PlexPluginArtResourceName Default: 'art-default.jpg' PlexPluginTitleBarResourceName Default: 'title...

Repairing Windows Tools & Articles

For those times when we all think that it surely must be a simple thing to fix an annoying windows problem your facing than reinstalling or for those times when you forgot to take a recent full system image: Here is a compilation of tools and articles I’ve used to try and fix some windows registry / component problems. View ALL the hidden devices in device manager Ghost/Hidden Network Interfaces Repairing corrupt files using SFC (Windows 7/8) Use the System File Checker tool to repair missing or corrupted system files Repairing corrupt files using SFC (Windows 8 / Server 2012) Fixing component store corruption in Windows 8 and Windows Server 2012 Resetting the TCP/IP stack How to reset TCP/IP by using the NetShell utility Windows 7: Wifi adapter could not bind IP protocol stack to network adapter Checking USB2/3 connection speed Verifying USB connection speed (USB 3 or USB 2?) Comparing registry changes REGDIFF – compares 2 exports, compares an export and current, so...

Developing Plex Media Server Plugins

Plex Media Server has a nicely extensible API for writing plugins which are classified into channels, agents and services. However in trying to tweak a plugin I wanted to get working, I’ve discovered that the API that forms the latest Plex Media Server doesn’t match up with the API Reference provided. My next post I’ll give dumps of the runtime API and the differences in the object model – which aren’t too much of a big deal unless your doing audio only plugins (I’m getting a streaming radio station channel working). There also didn’t seem to be a SDK or toolset for developing the plugins, which upon looking at the plugin bootstrap procedure I can understand why – a lot of the classes are dynamically generated and together with some other imports, are set as global variables on the plugin’s executed __init__.py I spent a bit of time trying to get PyDev to compile using some hackery but the way I was trying to do it I hit too many hurdles. I was trying to add the globals that are ...