September 2007
Monthly Archive
Fri 28 Sep 2007
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
Wed 19 Sep 2007
Hello,
PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL 3.x and 4.x databases.
PDO_MYSQL will take advantage of native prepared statement support present in MySQL 4.1 and higher. If you’re using an older version of the mysql client libraries, PDO will emulate them for you.
Steps to compile compile pdo_mysql module with php
1) Download the PDO package to server
# wget http://pecl.php.net/get/PDO
2) Manually build and install the PDO extension:
# tar xzf PDO-0.2.tgz
# cd PDO-0.2
# phpize
# ./configure
# make
# make install
# echo extension=pdo.so >> /usr/local/php5/lib/php.ini
3) rebuild PHP along with the drivers for PDO_mysql.
CUSTOM_PHP_FLAGS=”–with-pdo-mysql” /scripts/easyapache
4) check php module using php –m command
Enjoys
Fri 14 Sep 2007
301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It’s not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it’s the safest option. The code “301″ is interpreted as “moved permanently”.
IIS Redirect
- In internet services manager, right click on the file or folder you wish to redirect
- Select the radio titled “a redirection to a URL”.
- Enter the redirection page
- Check “The exact url entered above” and the “A permanent redirection for this resource”
- Click on ‘Apply’
ColdFusion Redirect
<.cfheader statuscode=”301″ statustext=”Moved permanently”>
<.cfheader name=”Location” value=”http://www.new-url.com”>
PHP Redirect
<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.new-url.com” );
?>
ASP Redirect
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”;
Response.AddHeader(”Location”,”http://www.new-url.com/”);
%>
ASP .NET Redirect
<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”http://www.new-url.com”);
}
</script>
JSP (Java) Redirect
<%
response.setStatus(301);
response.setHeader( “Location”, “http://www.new-url.com/” );
response.setHeader( “Connection”, “close” );
%>
CGI PERL Redirect
$q = new CGI;
print $q->redirect(”http://www.new-url.com/”);
Ruby on Rails Redirect
def old_action
headers[”Status”] = “301 Moved Permanently”
redirect_to “http://www.new-url.com/”
end
Redirect Old domain to New domain
Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Please REPLACE www.newdomain.com in the above code with your actual domain name.
In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.
Redirect to www
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Please REPLACE domain.com and www.newdomain.com with your actual domain name.