tux 2 linux logo

Maurizio Proietti centosLinuxphp

Risorse da consultare http://codex.wordpress.org/Nginx#URL_Rewrites_.2F_Permalinks http://www.krizna.com/centos/install-lemp-on-centos-6/ http://nginx.org/en/linux_packages.html#stable Installazione nginx su CentOS 6* wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm rpm -Uhv nginx-release-centos-6-0.el6.ngx.noarch.rpm vim /etc/yum.repos.d/nginx.repo aggiungi priority=10 yum install nginx per la configurazione vedi la directory conf https://github.com/MaoX17/nginx-php-fpm-wordpress-high-performance Installazione php-fpm 5.4 su CentOS 6* yum install centos-release-SCL

Share

nginx per wordpress con alti volumi di traffico su CentOS 6x

Risorse da consultare

http://codex.wordpress.org/Nginx#URL_Rewrites_.2F_Permalinks
http://www.krizna.com/centos/install-lemp-on-centos-6/
http://nginx.org/en/linux_packages.html#stable

Installazione nginx su CentOS 6*

wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

rpm -Uhv nginx-release-centos-6-0.el6.ngx.noarch.rpm

vim /etc/yum.repos.d/nginx.repo

aggiungi

priority=10

yum install nginx

per la configurazione vedi la directory conf
https://github.com/MaoX17/nginx-php-fpm-wordpress-high-performance

Installazione php-fpm 5.4 su CentOS 6*

yum install centos-release-SCL

yum update

yum install php54*

per la configurazione vedi la directory conf
https://github.com/MaoX17/nginx-php-fpm-wordpress-high-performance

Installazione redis su CentOS 6*

yum install redis.x86_64

/opt/rh/php54/root/usr/bin/pecl install redis

You should add “extension=redis.so” to php.ini

dopo controlla phpinfo

/opt/rh/php54/root/usr/bin/pear channel-discover pear.nrk.io

/opt/rh/php54/root/usr/bin/pear remote-list -c nrk

/opt/rh/php54/root/usr/bin/pear install nrk/predis

ricorda di installare il plugin per redis su wordpress e il plugin WP-Super-Cache

per la configurazione vedi la directory conf
https://github.com/MaoX17/nginx-php-fpm-wordpress-high-performance

Share
Pubblicato in centos, Linux, php
tux 2 linux logo

Maurizio Proietti centosLinux

# Bacula Step by Step Per maggiori informazioni, aggiornamenti ed esempi di configurazione clicca qui https://github.com/MaoX17/Bacula-7-step-by-step ## Installazione yum install yum install mysql mysql-devel mysql-server mysql-libs perl-DBD-MySQL perl-DBI yum install php-* wget https://repos.fedorapeople.org/repos/slaanesh/bacula7/epel-bacula7.repo cp epel-bacula7.repo /etc/yum-repos.d/ yum update yum install

Share

install and configure backup bacula 7 webacula bacula-web

# Bacula Step by Step

Per maggiori informazioni, aggiornamenti ed esempi di configurazione clicca qui
https://github.com/MaoX17/Bacula-7-step-by-step

## Installazione

yum install yum install mysql mysql-devel mysql-server mysql-libs perl-DBD-MySQL perl-DBI

yum install php-*

wget https://repos.fedorapeople.org/repos/slaanesh/bacula7/epel-bacula7.repo
cp epel-bacula7.repo /etc/yum-repos.d/
yum update

yum install mt*

yum install bacula*

yum install epel-release

## Configurazione

cd /usr/libexec/bacula/

./create_mysql_database
./make_mysql_tables
./grant_mysql_privileges

Collego bacula a mysql
alternatives –config libbaccats.so

### Impostazione per la libreria automatizzata (Sun StorageTek L40 Tape Library)

vim /usr/libexec/bacula/mtx-changer.conf
offline=1
offline_sleep=60
load_sleep=60
inventory=0
vxa_packetloader=0
debug_log=1

#### Se la libreria conteneva dati e si vuole una situazione pulita

prima di fare RELABEL

##### Script per riavvolgere i nastri e svuotarli
for i in {1..40}
do
echo $i
/usr/libexec/bacula/mtx-changer /dev/sg3 load $i /dev/st0 0 && mt -f /dev/st0 rewind && mt -f /dev/st0 weof && mt -f /dev/st0 rewind && /usr/libexec/bacula/mtx-changer /dev/sg3 unload $i /dev/st0 0
done

#### Label dei volumi (nastri) con Barcodes

bconsole
label barcodes

##### Note
If your autochanger has barcode labels, you can label all the Volumes in your autochanger one after another by using the label barcodes command. For each tape in the changer containing a barcode, Bacula will mount the tape and then label it with the same name as the barcode. An appropriate Media record will also be created in the catalog. Any barcode that begins with the same characters as specified on the “CleaningPrefix=xxx” command, will be treated as a cleaning tape, and will not be labeled. For example with:

Please note that Volumes must be pre-labeled to be automatically used in the autochanger during a backup. If you do not have a barcode reader, this is done manually (or via a script).

Pool {
Name …
Cleaning Prefix = “CLN”
}
Any slot containing a barcode of CLNxxxx will be treated as a cleaning tape and will not be mounted.

#### Label del volume per il backup del Catalog
bconsole
label
Automatically selected Catalog: MyCatalog
Using Catalog “MyCatalog”
The defined Storage resources are:
1: File1
2: File2
3: STK
Select Storage resource (1-3): 1
Enter new Volume name: Vol-File-Bkp
Defined Pools:
1: Default
2: Nastri-Win
3: Nastri-LNX
4: File
5: Scratch
Select the Pool (1-5): 1

Catalog record for Volume “Vol-File-Bkp”, Slot 0 successfully created.

*quit

#### ATTENZIONE In caso di errori (catalog not found)

check the permissions of your bacula-dir.conf. Your bacula-dir runs as user bacula and MUST have
enough permissions to read its bacula-dir.conf (and also the query.sql).

chmod -R 777 /etc/bacula

## Installazione di Webacula
(http://webacula.sourceforge.net/)

download and unpack webacula7

mv webacula-7.0.0 /usr/share/webacula
cp /usr/share/webacula/install/apache/webacula.conf /etc/httpd/conf.d/

### Installo i componenti necessari a webacula

yum install php-ZendFramework-full.noarch php-ZendFramework-Auth-Adapter-Ldap.noarch php-ZendFramework-Db-Adapter-Mysqli.noarch php-ZendFramework-Db-Adapter-Pdo-Mysql.noarch

### Imposto i permessi per webacula tramite sudo

visudo:
……
Defaults requiretty

### Per webacula
Defaults:apache !requiretty
apache ALL = NOPASSWD: /usr/sbin/bconsole, /sbin/stop

### Imposto la password di webacula
./password-to-hash.php ##PASSWORD##

paste it in db.conf

### Ulteriori configurazioni di webacula
cd /usr/share/webacula/
vim application/config.ini

cd /usr/share/webacula/install
./check_system_requirements.php

cd MySql/
./10_make_tables.sh
./20_acl_make_tables.sh

#### In caso estremo (per risolvere i problemi di login):
mysql
use bacula
update webacula_users set pwd=’$P$BMAiISUFah71ZDpzy1Vx1emAZU5Rli1′ where id = 1000;

## Installazione di Bacula Web
(http://www.bacula-web.org/)
download bacula-web 7
The latest version Bacula-Web is available through the project site download page
http://www.bacula-web.org/download.html

Go to your Apache root’s folder
cd /var/www/html
mkdir -v bacula-web
tar -xzvf bacula-web.tar.gz -C /var/www/html/bacula-web
chown -Rv apache: /var/www/html/bacula-web
chmod -Rv ug+w /var/www/html/bacula-web/application/view/cache

From the installation folder, go to the folder mentioned below
application/config/

– Open the file config.php.sample and modify the settings regarding your installation
– Save this file as config.php in the same folder

### Test

Open your web browser and go to the address below

http://youserver/bacula-web/test.php

## RESTART BACULA FULL
for i in `ls /etc/init.d/bacula-*`; do $i $1; done

Share
Pubblicato in centos, Linux
tux 2 linux logo

Maurizio Proietti Linuxmysqlphp

Qui potrete trovare alcune utili applicazioni web che ho realizzato Maurizio Proietti su GitHub

Share

Eccomi su GitHub

Qui potrete trovare alcune utili applicazioni web che ho realizzato

Maurizio Proietti su GitHub

Share
Pubblicato in Linux, mysql, php
tux 2 linux logo

Maurizio Proietti centosphp

How to install php-mcrypt for php-5.4 on CentOs 6.x SCL wget http://rpms.southbridge.ru/rhel6/php-5.4/x86_64/php-mcrypt-5.4.16-1.el6.x86_64.rpm By EPEL: yum inatall libmcrypt yum install php-common rpm2cpio php-mcrypt-5.4.16-1.el6.x86_64.rpm | cpio -idmv cp etc/php.d/mcrypt.ini /opt/rh/php54/root/etc/php.d/ cp usr/lib64/php/modules/mcrypt.so /opt/rh/php54/root/usr/lib64/php/modules/ vim /opt/rh/php54/root/etc/php.ini and add extension=mcrypt.so

Share

How to install php-mcrypt on php-5.4 SCL

How to install php-mcrypt for php-5.4 on CentOs 6.x SCL

wget http://rpms.southbridge.ru/rhel6/php-5.4/x86_64/php-mcrypt-5.4.16-1.el6.x86_64.rpm

By EPEL:
yum inatall libmcrypt
yum install php-common

rpm2cpio php-mcrypt-5.4.16-1.el6.x86_64.rpm | cpio -idmv

cp etc/php.d/mcrypt.ini /opt/rh/php54/root/etc/php.d/
cp usr/lib64/php/modules/mcrypt.so /opt/rh/php54/root/usr/lib64/php/modules/

vim /opt/rh/php54/root/etc/php.ini
and add
extension=mcrypt.so
Share
Pubblicato in centos, php
tux 2 linux logo

Maurizio Proietti Linux

wget -m –ftp-user=xxxx –ftp-password=yyy ftp://ftp.dominio.it/www.dominio.it/ nohup comando Then press ctrl + z which will temporarily suspend the command bg This will start executing the command in backgroud To see what background process that is running you can type command: $

Share

Trasferire via ftp solo i file nuovi

wget -m --ftp-user=xxxx --ftp-password=yyy ftp://ftp.dominio.it/www.dominio.it/

nohup comando
Then press ctrl + z which will temporarily suspend the command
bg
This will start executing the command in backgroud
To see what background process that is running you can type command:
$ jobs

rsync -avzu -e "ssh -p 2222" root@xx.xx.xx.xx:/var/www/html/ORIG/* /home/DEST/public_html/ > /home/DEST/public_html/rsync.log 2> /home/DEST/public_html/rsync.err

Share
Pubblicato in Linux
tux 2 linux logo

Maurizio Proietti php

Installazione Propel just create a new composer.json file at the root of your project’s directory with the following content: { “require”: { “propel/propel”: “~2.0@dev” } } wget http://getcomposer.org/composer.phar php composer.phar install Per testarlo: cd myproject e lancia vendor/bin/propel export PATH=$PATH:/path/to/vendor/bin/

Share

Propel e portali – appunti utili… a me

Installazione Propel

just create a new composer.json file at the root of your project’s directory with the following content:

{
"require": {
"propel/propel": "~2.0@dev"
}
}

wget http://getcomposer.org/composer.phar

php composer.phar install

Per testarlo:

cd myproject
e lancia
vendor/bin/propel
export PATH=$PATH:/path/to/vendor/bin/
cd mkdir propel
mkdir propel/class
propel init
propel model:build
vim composer.json
{
"require": {
"propel/propel": "~2.0@dev"
},
"autoload": {
"classmap": ["propel/class/"]
}
}

php composer.phar dump-autoload

propel config:convert

nei file php:

require_once 'include.inc.php';
// setup the autoloading
require_once 'vendor/autoload.php';
//require_once 'vendor/autoload.php';
// setup Propel
require_once 'generated-conf/config.php';

e poi:

 $avviso->setDtAvviso("2013-12-11");
echo $avviso->getAvviso();
var_dump($avviso->getDtAvviso());
$d1=new DateTime("2012-07-08 11:14:15.638276");
var_dump($d1);
echo $d1->format('Y-m-d H:i');
echo $avviso->getDtAvviso()->format('Y-m-d H:i');
$newDate = $avviso->getDtAvviso();
$newDate = $newDate->format('Y-m-d H:i:s'); // for example
$avviso->save()
?>

[modifica]
Propel – Installazione con reverse

just create a new composer.json file at the root of your project’s directory with the following content:

{
"require": {
"propel/propel": "~2.0@dev"
}
}

wget http://getcomposer.org/composer.phar

php composer.phar install

Per testarlo:

cd myproject
e lancia
vendor/bin/propel
export PATH=$PATH:/path/to/vendor/bin/
cd mkdir propel
mkdir propel/class
genera il file propel.yml :
Attenzione che deve essere INDENTATO!!!!
propel:
  general:
      project: bandi_concorsi
      version: 0.4

  paths:
      projectDir:  /var/www/vhosts/bandi_concorsi
      schemaDir: /var/www/vhosts/bandi_concorsi/propel
      phpDir: /var/www/vhosts/bandi_concorsi/propel/class
      phpConfDir: /var/www/vhosts/bandi_concorsi/propel
      # Directory in which your composer.json resides
#      composerDir: {empty}

## All Database settings ##
  database:
      connections:
          default:
              adapter: mysql
              dsn: mysql:host=localhost;dbname=bandi_concorsi
              user: root
              password:
              settings:
                  charset: utf8

          bandi_concorsi:
              adapter: mysql
              dsn: "mysql:host=localhost;dbname=bandi_concorsi"
              user: root
              password:
              settings:
                  charset: utf8

          albopretorio:
              adapter: mysql
              dsn: "mysql:host=192.168.0.20;dbname=albopretorio"
              user: user_db
              password: pass_db_pass
              attributes:

          protocollo:
              adapter: pgsql
              dsn: "pgsql://protocolloro:protocolloro@192.168.0.23:5433/protocollo"
              user: protocolloro
              password: protocolloro
              attributes:
propel reverse --output-dir="./propel"
propel model:build
vim composer.json
{
"require": {
"propel/propel": "~2.0@dev"
},
"autoload": {
"classmap": ["propel/class/"]
}
}

php composer.phar dump-autoload

propel config:convert

nei file php:

require_once 'include.inc.php';
// setup the autoloading
require_once 'vendor/autoload.php';
//require_once 'vendor/autoload.php';
// setup Propel
require_once 'propel/config.php';

e poi:

 $avviso->setDtAvviso("2013-12-11");
echo $avviso->getAvviso();
var_dump($avviso->getDtAvviso());
$d1=new DateTime("2012-07-08 11:14:15.638276");
var_dump($d1);
echo $d1->format('Y-m-d H:i');
echo $avviso->getDtAvviso()->format('Y-m-d H:i');
$newDate = $avviso->getDtAvviso();
$newDate = $newDate->format('Y-m-d H:i:s'); // for example
$avviso->save()
?>
Share
Pubblicato in php
tux 2 linux logo

Maurizio Proietti centosLinux

Thanks to http://sharadchhetri.com/2015/04/04/install-php-5-4-on-centos-6-with-yum-command/ Step 1. Install SCL repo only by hitting below given command. yum install centos-release-SCL Step 2. Install php 5.4 version on system now. yum install php54 To install specific package, package name should be known. Hence, to

Share

Installare php 5.4 su CentOs 6.x

Thanks to
http://sharadchhetri.com/2015/04/04/install-php-5-4-on-centos-6-with-yum-command/

Step 1. Install SCL repo only by hitting below given command.

yum install centos-release-SCL

Step 2. Install php 5.4 version on system now.

yum install php54

To install specific package, package name should be known. Hence, to get the list of available package list from SCL repo run below given command.

yum list|grep php

Step 3. Activate the PHP 5.4 on system.
NOTE: If you run below given command directly from terminal then on next login you will not find PHP 5.4 path.

source /opt/rh/php54/enable

Basically the above command, make PHP 5.4 executable path and environment available to current login user.

To make PHP 5.4 available to all user , we have to add line source /opt/rh/php54/enable inside file called /etc/profile. Now activate without logout by running command.

source /etc/profile

Or in case, if you only want php 5.4 available to specific user then just only edit .bashrc or .bash_profile file from User’s home directory. And add line source /opt/rh/php54/enable .

Step 4. Now check the php version

php -v

Below given is reference from our system.

[root@localhost ~]# php -v
PHP 5.4.16 (cli) (built: Nov 19 2014 08:05:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[root@localhost ~]#
IMPORTANT NOTE : The PHP 5.4 package actually installed in /opt/rh directory.

ATTENZIONE!!!! Abilitazione x virtualhost

thanks to: http://www.ilsistemista.net/index.php/linux-a-unix/45-joomla-3-3-centos-6-and-php-version-putting-all-together.html?start=1

Step n.1: enable the SCL repo and install PHP 5.4

yum install -y centos-release-SCL.x86_64
yum install -y php54.x86_64 php54-php-mysqlnd

Step n.2: create a PHP wrapper script in /var/www/cgi-bin/php54-wrapper

#!/bin/bash
source /opt/rh/php54/enable
exec php-cgi $1

Then give it the appropriate permissions and restore the selinux context:

restorecon -RF /var/www/cgi-bin/php54-wrapper
chown apache:apache /var/www/cgi-bin/php54-wrapper
chmod ugo-rwx /var/www/cgi-bin/php54-wrapper
chmod ug+rx /var/www/cgi-bin/php54-wrapper

Step n.3: configure the appropiate VirtualHost to use the new PHP version via the CGI interface

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php54-wrapper
Options +ExecCGI

This configuration instruct Apache to use the new PHP 5.4 version for this and only this Virtualhost, leaving all others configuration intact: other Virtualhosts will continue to use PHP 5.3 version via mod_php.

 

Nota:

se smette di funzionare occorre rinominare il file

/etc/httpd/conf.d/php54-php.conf

in

/etc/httpd/conf.d/php54-php.conf.vhosts

Share
Pubblicato in centos, Linux
tux 2 linux logo

Maurizio Proietti configurazionephp

Premetto che ritengo la “cookie law” una delle cose più stupide ed inutili mai viste. Paragonabile FORSE solo alla norma sugli amministratori di sistema in quando a idiozia. Detto questo… visto che siamo TUTTI costretti ad adeguarci … UBBIDISCO.. Ma

Share

Cookie Law – La stupidità nel regolamentare l’uso dei cookie

Premetto che ritengo la “cookie law” una delle cose più stupide ed inutili mai viste.
Paragonabile FORSE solo alla norma sugli amministratori di sistema in quando a idiozia.
Detto questo… visto che siamo TUTTI costretti ad adeguarci … UBBIDISCO..

Ma vorrei sollevare una riflessione… quanto sarà costato e costerà a tutti, enti pubblici e società private, questo stupido giochetto ?

Meditate gente, meditate!

Detto questo … ecco la soluzione più rapida che ho trovato (quando non sia possibile adottare un plugin ad HOC)

Nella sezione HEAD del sito aggiungere quanto segue:


<!-- ---------------- cookie ------------------------- -->
<link rel="stylesheet" media="screen" href="http://www.provincia.prato.it/cookie.css" type="text/css" />
<!-- ---------------- /cookie ------------------------- -->

Nel Body inserire in alto quanto segue:

<!-- ---------------- cookie ------------------------- -->
<div id="banner_cookie">
<div id="banner_interno">
<div id="banner_sx">
Questo sito utilizza cookies tecnici e di terze parti per funzionalit&agrave; quali la condivisione sui <i>social network</i> e/o la visualizzazione
di media.
Se non acconsenti all'utilizzo dei cookie di terze parti, alcune di queste funzionalit&agrave; potrebbero essere non disponibili.
Per maggiori informazioni consulta la <a target="_blanc" href="http://www.miosito.it/privacy_cookie.html">privacy policy</a>
</div>
<div id="banner_dx">
Acconsenti all'utilizzo di cookie di terze parti?
<br />
<br />
<a href='javascript:void(0);' onclick='CookieOk();'><b>Si, acconsento</b></a>
<a href='javascript:void(0);' onclick='CookieKo();'><b>No, non acconsento</b></a>
</div>
</div>
</div>

<script type="text/javascript" src="http://www.miosito.it/cookie.js"></script>
<!-- ---------------- /cookie ------------------------- -->

I due file sono i seguenti:

cookie.css:

#banner_cookie {
display: none;
z-index: 99999;
position: fixed;
left: 0px;
right: 0px;
top: 0px;
width: 100%;
min-height: 40px;
padding: 14px;
background-color: #000000;
background-color: rgba(0, 0, 0, 0.8);
color: #ffffff;
line-height: 1.5;
font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
text-align: left;
}

#banner_interno {
width: 960px;
margin-left: auto;
margin-right: auto;
}
#banner_sx {
width: 60%;
float: left;
padding-right: 24px;
}

#banner_dx {
width: 35%;
float: right;
}

#banner_sx a {
color: #ffffff;
text-decoration: underline;
}

#banner_sx a:hover, #banner_sx a:focus {
color: #000000;
background: #ffffff;
text-decoration: underline;
}

#banner_dx a {
padding: 4px;
border-radius: 4px;
background: #dfdfdf;
color: #000000;
font-weight: bold;
text-decoration: none;
}

#banner_dx a:hover, #banner_dx a:focus {
color: #dfdfdf;
background: #000000;
}

cookie.js:

function CookieOk()
{
var expiration = new Date();
expiration.setTime(expiration.getTime() + (60000*60*24*365));
setCookie("ok_cookie","1",expiration,"/");
document.getElementById("banner_cookie").style.display="none";
window.location.reload(true);
}
function CookieKo()
{
var expiration = new Date();
expiration.setTime(expiration.getTime() + (60000*60*24*365));
setCookie("ok_cookie","2",expiration,"/");
document.getElementById("banner_cookie").style.display="none";
}

function setCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+((expires==null)?"":"; expires="+expires.toGMTString())+((path==null)?"":"; path="+path)+((domain==null)?"":"; domain="+domain)+((secure==null)?"":"; secure")}
function getCookie(name){var cname=name+"=";var dc=document.cookie;if(dc.length>0){begin=dc.indexOf(cname);if(begin!=-1){begin+=cname.length;end=dc.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin,end))}}return null}
function delCookie(name,path,domain){if(getCookie(name)){document.cookie=name+"="+((path==null)?"":"; path="+path)+((domain==null)?"":"; domain="+domain)+"; expires=Thu, 01-Jan-70 00:00:01 GMT"}}

var check_cookie = getCookie("ok_cookie");

if ( (check_cookie == null) || (window.location.href.indexOf("privacy")>0) )
{
document.getElementById("banner_cookie").style.display="block";
}
Share
Pubblicato in configurazione, php
tux 2 linux logo

Maurizio Proietti windowswindows 7

Abilitazione di NPAPI in Chrome versione 42 e successive A partire dalla versione 42 di Chrome, è richiesto un passo di configurazione supplementare per continuare a usare i plugin NPAPI. Nella barra degli URL, immettere: chrome://flags/#enable-npapi Fate clic sul collegamento

Share

Problemi chrome e plugin java

Abilitazione di NPAPI in Chrome versione 42 e successive
A partire dalla versione 42 di Chrome, è richiesto un passo di configurazione supplementare per continuare a usare i plugin NPAPI.

Nella barra degli URL, immettere:

chrome://flags/#enable-npapi 

Fate clic sul collegamento Abilita per l’opzione di configurazione Abilita NPAPI.
Fate clic sul pulsante Riavvia che ora compare nella parte inferiore della pagina di configurazione.
Gli sviluppatori e gli amministratori di sistema interessati a metodi alternativi per supportare gli utenti di Chrome possono vedere questo blog, in particolare le sezioni relative all’esecuzione di applicazioni Web Start al di fuori di un browser e alle altre opzioni di distribuzione.

Share
Pubblicato in windows, windows 7
tux 2 linux logo

Maurizio Proietti centosLinux

from: major.io This error completely stumped me a couple of weeks ago. Apparently someone was adjusting the Apache configuration, then they checked their syntax and attempted to restart Apache. It went down without a problem, but it refused to start

Share

Apache: No space left on device: Couldn’t create accept lock

from: major.io

This error completely stumped me a couple of weeks ago. Apparently someone was adjusting the Apache configuration, then they checked their syntax and attempted to restart Apache. It went down without a problem, but it refused to start properly, and didn’t bind to any ports.

Within the Apache error logs, this message appeared over and over:

[emerg] (28)No space left on device: Couldn’t create accept lock
Apache is basically saying “I want to start, but I need to write some things down before I can start, and I have nowhere to write them!” If this happens to you, check these items in order:

1. Check your disk space
This comes first because it’s the easiest to check, and sometimes the quickest to fix. If you’re out of disk space, then you need to fix that problem. :-)

2. Review filesystem quotas
If your filesystem uses quotas, you might be reaching a quota limit rather than a disk space limit. Use repquota / to review your quotas on the root partition. If you’re at the limit, raise your quota or clear up some disk space. Apache logs are usually the culprit in these situations.

3. Clear out your active semaphores
Semaphores? What the heck is a semaphore? Well, it’s actually an apparatus for conveying information by means of visual signals. But, when it comes to programming, semaphores are used for communicating between the active processes of a certain application. In the case of Apache, they’re used to communicate between the parent and child processes. If Apache can’t write these things down, then it can’t communicate properly with all of the processes it starts.

I’d assume if you’re reading this article, Apache has stopped running. Run this command as root:

ipcs -s

If you see a list of semaphores, Apache has not cleaned up after itself, and some semaphores are stuck. Clear them out with this command:

 for i in `ipcs -s | awk '/httpd/ {print $2}'`; do (ipcrm -s $i); done

Now, in almost all cases, Apache should start properly. If it doesn’t, you may just be completely out of available semaphores. You may want to increase your available semaphores, and you’ll need to tickle your kernel to do so. Add this to /etc/sysctl.conf:

kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024

And then run

sysctl -p 

to pick up the new changes.

Share
Pubblicato in centos, Linux

Condividimi

Share

Archivio

SEO