Menu Close

Category: News

PHP Session Locks – How to Prevent Blocking Requests

by konrness.com

php[1]Many people are aware that modern browsers limit the number of concurrent connections to a specific domain to between 4 or 6. This means that if your web page loads dozens of asset files (js, images, css) from the same domain they will be queued up to not exceed this limit. This same problem can happen, but even worse, when your page needs to make several requests to PHP scripts that use sessions.

Problem

PHP writes its session data to a file by default. When a request is made to a PHP script that starts the session (session_start()), this session file is locked. What this means is that if your web page makes numerous requests to PHP scripts, for instance, for loading content via Ajax, each request could be locking the session and preventing the other requests from completing.

The other requests will hang on session_start() until the session file is unlocked. This is especially bad if one of your Ajax requests is relatively long-running.

log cron jobs

If you need to check what is the output from every cron job (instead of see only when start and stop it in var/log/syslog)

you can append to your cron command this text:

 2>&1 >> /var/log/myjob.log

and here you can see a working example:

rsync -avz /home/www/ /mnt/ububackup/SITE_BACKUP 2>&1 >> /var/log/backupUbu.log

This cron sync my www folder to another server and log the output to backupUbu.log .

 

Certificati SSL su vhost multipli

Con il passaggio di dominio ad uno personalizzato mi si è reso necessario la creazione di un certificato SSL per permettere l’utilizzo di comunicazioni HTTPS sul mio dominio.

Ho però necessità di certificare piu vhost (sottodomini) con ognuno funzionalità diverse.

Esistono dei certificati SSL chiamati WildCard che permettono per l’appunto di certificare piu sottodomini con un’unico certificato SSL, questi però vanno da circa $80/anno fino anche a $400-$500/anno! Non mi sembra il caso per un sito “amatoriale”.

Ho provato quindi a certificare ogni vhost con un SSL diverso, pagando per ognuno circa 2€ l’anno, ecco com’è andata!

 

Gestione IpFire e Firewall Linux

 

IPFire Fails to make ADSL Connection

 

Have you checked the Link status of you network cable?

If you don’t get a lease it is normal that red0 was disabled.

Check with “ifconfig -a”

go to console and Press ALT+F12 to see the systemlog (or use tail -f /var/log/messages over ssh)

 

Check the Syslog (/var/log/messages) or in the WebIF (kernel and red)

 

cat /var/ipfire/ethernet/settings

 

“eth0: link is not ready” but device is present

Looks like the cable is not connected or it is damaged. (No Link)

You can double check with ethtool.

 

Quote:
sudo ethtool eth0

 

How to Change the Hostname of a Linux System

by ducea.com

Normally we will set the hostname of a system during the installation process. Many peoples don’t care about this, and don’t change the hostname even if for example this was set to something really stupid by the datacenter that installed the system (most likely they will set this to “debian” on any debian installation, etc). For me, it is important to see on each one of the ssh screens I will have open at any time a different hostname that is relevant and will give me quickly the information on what system I am logged in.

Change Ubuntu Server from DHCP to a Static IP Address

by howtogeek.com

If the Ubuntu Server installer has set your server to use DHCP, you will want to change it to a static IP address so that people can actually use it.

Changing this setting without a GUI will require some text editing, but that’s classic linux, right?

Let’s open up the /etc/network/interfaces file. I’m going to use vi, but you can choose a different editor

sudo vi /etc/network/interfaces

SOLUTION: 1215n Windows 8 Upgrade Causes Hotkeys to Stop Working (Missing Asus ACPI Driver)

I recently purchased an Asus 1215n equipped with Windows 7 64bit. The first thing I did was upgrade to Windows 8 since Microsoft is offering a promotional price of $15 until January 2013. Doing so led to some Hotkey driver compatibility issues though (missing Asus ACPI driver error + no working hotkeys), which were a pain to resolve to say the least. I was unable to find a solution on the web anywhere (one that worked anyways), so I had to figure things out myself. I’m posting my solution here in the hopes that it will be useful to others doing an upgrade to windows 8. I imagine that the solution would also apply to other 1215x models (1215b for example) that came with Windows 7 64bit. Im not sure if this solution is applicable to 32bit Windows 7 versions, though you should definitely still give it a try.

Problem Description:

After installing windows 8 and logging in for the first time an error message window popped up:

“Missing Asus ACPI Driver.”

 

When to use $_SESSION vs $_COOKIE

by buildinternet.com

A critical feature in web programming is the ability to seamlessly pass data from one page load to the next. It’s used most commonly when dealing with user logins, but also for passing error messages, shopping carts, etc.

Storing data across pages using PHP is done with two variables in the global scope, called $_SESSION and $_COOKIE, and although accomplishing the same end goal, the both go about it in very different ways. The purpose of this article is to give a brief look into the differences between cookies and sessions, when it’s better to use one versus the other, and the pros and cons of the two.

The difference is in how each store data. Cookies store data locally in the user’s browser, while sessions store data on the webserver.

 

5 JQuery Infinite Scrolling Demos

by JQuery4you.com

Here are 5 demos which you could use as the barebones for your next infinite scrolling project. I’ve been playing around with infinite scrolling for one of my projects and I’ve tried a few jQuery plugins which can manage the “endless scroll” showing items, posts, rss feeds, tweets or anything really. The content can be generated dynamically from JavaScript but most commonly loaded from a server script using AJAX. Also I found that Firefox 8 only detects the scroll upto 99.85% of the screen which was strange.

Infinite Scrolling Demo 1

This demo uses the jQuery Masonry plugin together with the Infinite Scroll plugin. The Masonry plugin really is good for obtaining fluid layouts definately recommend it for that. The infinite scroll plugin by Paul Irish is good at loading pages which already exist such as page.html, page2.html, page3.html but it can’t handle dynamic generated content such as hitting the same page.php file with appended parameters page.php?data=xxx. Just bear that in mind if you go with this option.

infinitescroll1

 

Configuring a SOCKS Proxy and Tunneling With Dante

Obtaining Dante from repository

Dante is a fully functional SOCKS proxy server and as such has many nobs. Fortunately, setting up a basic configuration that will allow tunneling of things like HTTP is relatively simple. If you’re running Debian GNU/Linux, simply run:

# apt-get update
# apt-get install dante-server

Configuring Dante

remember! Dante is a SOCKS host NOT an HTTP proxy, you are going to get all sorts of weird errors if you get this wrong.

The configuration file is locate in

# cat /etc/danted.conf