Archive for the ‘Linux servers’ Category

I was experiencing this issue with some larger file uploads using the CakePHP Media plugin.
https://bugs.webkit.org/show_bug.cgi?id=5760
Add this to the virtual host declaration in your Apache config file to fix it:
123456<VirtualHost x.x.x.x:x>

    # Prevent Safari from hanging on uploads
    BrowserMatch  Safari  nokeepalive

</VirtualHost>

For my own records, had to look this up again today so thought best blog it:
12sudo chmod -R g+s *
# Would set group permissions recursively for all directories at the current location.
If anyone is interested, files in these directories will have the group ownership as the directory, instead of the group of the user that [...]

I had the issue where my MacBook creates files prefixed with ._ while working on a Samba share. I’ve fixed this once before but it was so long ago, I’ve forgotten how!! Anyway, I had a stack of these files in a checked-out svn project and needed to delete them. Rather than do each one [...]

Quick refresher for my own records:
123456xm list # list VMs
xm reboot domain # reboot VM
xm start domain # start VM
xm shutdown domain # shutdown VM
xm console domain # attach console to VM
ctrl + ] # detach from console

I managed to recompile PHP with some new directives and install it on my live production server with minimal downtime.
I followed these steps:
1) Downloaded the source of PHP. I stuck to the same branch (5.2) as there was nothing I required in 5.3.
2) Backed up my /etc/php.ini file.
3) Compiled PHP with ./configure using my old [...]

You can return the exit/return code of the command you just ran in OSX/Linux using this simple command:
1echo $?
This is handy when debugging scripts that rely on shell command return values.

You can use this in your MySQL WHERE clause to return records that were created within the last 7 days/week:
1created >= DATE_SUB(CURDATE(),INTERVAL 7 day)
You can also use NOW() in the subtraction to give hh:mm:ss resolution. So to return records created exactly (to the second) within the last 24hrs, you could do:
1created >= DATE_SUB(NOW(),INTERVAL 1 day)

Been doing some bash scripting of late, been meaning to for ages. Really enjoying it too!
Anyway, today I needed to match an exact string in a directory listing (ls). To check if a volume on my Mac Book was mounted, so I could backup to it. Or any other drive for that matter. I ended [...]

I had a whole site that was .htaccess password protected using Apache authentication:
12AuthType Basic
etc etc
I wanted to allow public access to a sub directory. I had to Google it for quite a while and finally worked it out. I added this to the child directory .htaccess file:
1Satisfy any
The password prompt is now gone for that [...]

I always used to log-out / log-back-in to shell, to allow changes in my .bash_profile to kick in. I’m guessing this would work in OSX with your .profile file too but I’ve not tested it. Anyways, I discovered you can reload the script on the fly using:
1source ~/.bash_profile


top