Software, Web Development

Nginx Truncating Any Web Page With or Without PHP

I had a problem recently (or rather, just now) whereby one of my Nginx installs was truncating PHP pages.

I soon figured out it was because Nginx was actually showing me the in-memory buffer output and cutting off file buffer. You see Nginx will first try and load your entire page into memory, when failing this it will pump the output to a file.

The problem is if Nginx cannot write to that file for some reason it will only give you the first in-memory output of a page.

The way to find out if this is happening to you and how to solve it is detailed here: but I will summarise it here to prevent link rot.

Your error.log should have a line like:

2014/07/08 08:19:25 [crit] 30100#0: *308814 open() "/var/lib/nginx/fastcgi/0/11/0000005110" failed (13: Permiss ion denied) while reading upstream, client:, server: localhost, request: "GET /xxxx/xxxx-xxxx  HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "", referrer: ""

And put simply, double check the permissions of your folders/files in: /var/lib/nginx/fastcgi, there is a very good chance they are not of the right permissions.

Linux, Web Development

Making npm Work on a Cifs/Windows Share

npm install --no-bin-links

This is since on a cifs partition npm will actually bail out with chmod when trying to set symlinks for the modules that it cannot due to you using a Windows share, since Windows has no concept of symlinks.


/etc/network/if-up.d/upstart: 38: cannot create /run/network/ifup.eth0: Directory nonexistent run-parts: /etc/network/if-up.d/upstart exited with return code 2 â€¦done.

I got this error today after an upgrade and Google searched a lot. Turns out some one had encountered this error and had got the perfect fix on Nemethge’s Blog

I am not sure exactly why this works but it seems like just symlinking your /var/run with your /run seems to do the trick. Anyway, you have him to thank for coming up with this solution. I can safely say it works (just tried it now). I have quoted the solution below just in case of dead link.

Note: This also solved the problem of my network settings not being found and Ubuntu waiting 60 secs before loading. So if your getting this problem then it could be related to the solution below however I have the same network problem on another network and that install of Ubuntu can find its network at startup despite the error message (can login remotely without having to restart the network for one). So this solution may not solve every case you get the network error message but it will in some cases.

It seems the move from /var/run to /run did not work during the upgrade process.

I fixed with this:

cd /var
mv run _run
ln -s /run .


E: Could not perform immediate configuration on ‘util-linux’. Please see man 5 apt

I stole this from the Ubuntu forums (haven’t got link anymore since I just pasted it here very quickly for reference):

I ran into this problem myself, and I’ve seen that others have had the same problem when updating from Karmic to Lucid via apt-get. There is a bug in apt for Lucid, and it has been noted on one of the Ubuntu lists (sorry, I lost the link.)

This is a simple how-to and a work-around to the upgrading with apt-get:

1) Update your sources.list file to replace all instances of ‘karmic” to ‘lucid’ :

$ sudo sed -i ‘s/karmic/lucid/g’ /etc/apt/sources.list

2) Run apt-get update:

$ sudo apt-get update

3) Run a regular upgrade;

$ sudo apt-get upgrade -y

Here is where the problem comes in. Apt is looking for the util-linux package, which is part of upstart-job, but someone apparenlty forgot to write the code to tell apt-about this (whoops!)

So, you now need to install upstart-job by itself. By skipping this step you will get the error message when you try to run step 5: “E: Could not perform immediate configuration on ‘util-linux’.Please see man 5 apt”

4) $ sudo apt-get install upstart-job

5) Now you can run apt-get dist-upgrade:

$ sudo apt-get dist-upgrade -y

Hope this helps out anyone who got stuck.