Archive

Archive for the ‘Cpanel Server’ Category

How to install mod_ruby and eruby on Linux server ?

April 8th, 2009 5 comments

What is mod_ruby?

mod_ruby embeds the Ruby interpreter into the Apache web server, allowing Ruby CGI scripts to be executed natively. These scripts will start up much faster than without mod_ruby.


1) Install eRuby

# wget http://www.modruby.net/archive/eruby-1.0.5.tar.gz

# tar -xzvf eruby-1.0.5.tar.gz

# cd eruby-1.0.5/

# ./configure.rb –with-charset=euc-jp –enable-shared

# make; make install

2) Install mod_ruby

i)Download latest mod_ruby tar file

# wget http://www.modruby.net/archive/mod_ruby-1.2.6.tar.gz

# tar -xzvf mod_ruby-1.2.6.tar.gz

# cd mod_ruby-1.2.6/

#  ./configure.rb –enable-eruby –with-apxs=/usr/local/apache/bin/apxs

# make; make install

ii)Edit apache configuration file ( httd.conf) and add following code

LoadModule ruby_module libexec/mod_ruby.so
ClearModuleList
AddModule mod_ruby.c
AddHandler cgi-script .rb
<IfModule mod_mime.c>

# for Ruby/eRuby
<IfModule mod_ruby.c>
# for Apache::RubyRun
RubyRequire apache/ruby-run
# for Apache::ERubyRun
RubyRequire apache/eruby-run
# for development
# RubyRequire auto-reload
# for add library
#RubyAddPath /usr/local/lib/ruby
# exec *.rbx as ruby scripts.
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
# handle *.rhtml as eruby files.
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Files>
</IfModule>
</IfModule>

iii) Restart apache service on server


Regards

Alex P

Fixing Apache “No space left on device: Couldn’t create accept lock” errors

April 3rd, 2009 No comments

Hello,

I was facing same error with one of my shared server last couple of week, apache was broke on server and getting following error in apache error logs file.

[emerg] (28)No space left on device: Couldn't create accept lock
[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
[warn] pid file /etc/httpd/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[emerg] (28)No space left on device: Couldn't create accept lock

I checked disk space, or quota limit but everything was fine. I through it seem to apache semaphore problem

Apache can create the “accept lock” is with a semaphore. A semaphore is an inter-process communication tool that is used by Apache to communicate with it’s child processes. This error message may mean that Apache couldn’t create a new semaphore.

Check to see how many semaphores are currently in use. If Apache is running correctly, you should see something like this:

# ipcs -s

If Apache is stopped, and you still see these semaphores, then you can safely kill them by running this command for each semaphore id (in the second column)

$ ipcrm -s <semid>

To destroy all semaphores, you can run this from the command line (with “apache” being the apache-user:

for semid in `ipcs -s | grep apachec | cut -f2 -d" "`; do ipcrm -s $semid; done

OR

ipcs -s | grep apache | perl -e ‘while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}’

OR

ipcs -s | grep nobody | perl -e ‘while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}’ ipcs -m | grep nobody | perl -e ‘while () { @a=split(/\s+/); print `ipcrm -m $a[1]`}’

OR

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

How to increase semaphore limit

To view the current parameters:

ipcs -l

To change these parameters, modify the file /etc/sysctl.conf and add the following lines:

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

Then load these settings with the command:

sysctl -p

Regards

StacyM

System Administrator

How do I enable/disable eAccelerator?

March 20th, 2009 No comments

eAccelerator is used improve performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution.
If  eAccelerator is installed on serverwide then it is enable for all account or you can enable it eAccelerator by makeing  a .htaccess file in your ‘htdocs’ directory, and add the following lines:

php_flag eaccelerator.enable 1
php_flag eaccelerator.optimizer 1

if you’d like to turn off eAccelerator for a particular directory, put the following in a .htaccess file in that subdirectory:

php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0

If php suexec is enabled on server then create php.ini file and following code in that file to disble eAccelerator.

eaccelerator.enable 0
eaccelerator.optimizer 0

Regards
Alex P
System Administrator

Categories: Cpanel Server Tags: