Skip to Content

Category Archives: apache

set custom php for a domain when server uses FCGI handler

Written on November 4, 2012 at 9:11 AM, by

Make a backup copy of your cPanel PHP wrapper script with the following command: cp -frp /usr/local/cpanel/cgi-sys/php5 /usr/local/cpanel/cgi-sys/php5-BACKUP   Now edit the cPanel PHP wrapper script with your favorite text editor: vi /usr/local/cpanel/cgi-sys/php5 By default this script should look like: #!/bin/sh # If you customize the contents of this wrapper script, place # a copy […]

access logs not functioning

Written on October 20, 2012 at 6:43 PM, by

Recently I found an issue where domlogs in the server was no updating. That is, all the the domains domlogs were empty. Due to this reason awstat was not updating for any domains in the server. The fix for this issue was to add the following piece of code to httpd.conf =========================== <IfModule mod_log_config.c> LogFormat […]

use tcpdump command to check conenctions to port 80

Written on September 18, 2012 at 10:55 AM, by

use the following command to get the connections: tcpdump -nn ‘tcp[13] == 2’ and port 80 -c 100 -i any    

Apache crashing Invalid argument: couldn’t grab the accept mutex

Written on August 5, 2012 at 5:16 AM, by

Error Obtained in apache error log: [Tue Jan 17 11:02:14 2012] [emerg] (22)Invalid argument: couldn’t grab the accept mutex [Tue Jan 17 11:02:14 2012] [emerg] (22)Invalid argument: couldn’t grab the accept mutex Solution: Add the following line to apache configuration file: AcceptMutex fcntl then, /usr/local/cpanel/bin/apache_conf_distiller –update –main /scripts/rebuildhttpdconf /etc/init.d/httpd graceful

To check if ssl is working fine on a site

Written on June 26, 2012 at 12:17 AM, by

To check if ssl is working fine on a site use the following php code on a test file and take it with https. If SSL is working fine, it will result, “You have initiated an SSL connection. You are secured”. <?php if($_SERVER[‘HTTPS’]){ echo ‘You have initiated an SSL connection. You are secured’; }else{ echo […]

Way to enable Apache Mod_Substitute

Written on June 23, 2012 at 1:23 AM, by

Download apache source to /usr/src change directory to /usr/src/httpd-2.2.11/modules/filters/ and run the following command: /usr/local/apache/bin/apxs -cia mod_substitute.c   Now open httpd.conf and check the following line: LoadModule substitute_module modules/ You need to the following lines also to httpd.conf for the working of this module. AddOutputFilterByType SUBSTITUTE text/html Restart apache. done.  

enabling allow_url_include locally in cPanel

Written on June 15, 2012 at 11:44 PM, by

When using cPanel the way to enable allow_url_include directive locally (per user) is to create an Virtual Host include: First create an include file: /usr/local/apache/conf/userdata/std/2/username/ Add directive to custom.conf: php_admin_flag allow_url_include On Then run to enable include: /scripts/ensure_vhost_includes –user=username –verbose Alternatively, enabling allow_url_include globally (server-wide) is done by editing /usr/local/lib/php.ini and adding “allow_url_include = On” […]

SymLinksIfOwnerMatch in apache conf

Written on June 13, 2012 at 4:20 PM, by

we  keep this option  “SymLinksIfOwnerMatch” in apache conf  to “On”, so that if a user creates symlink to his own files, apache will allow to access such files.  

Enable SSI using .htaccess in cpanel server

Written on June 13, 2012 at 1:51 AM, by

If you want to enable SSI [server side include] in cpanel server using .htaccess use the below rule, Options +Includes AddType text/html .shtm AddHandler server-parsed .shtml      

sample php mail script

Written on June 12, 2012 at 5:26 PM, by

<?php $server = $_SERVER[‘SERVER_NAME’]; mail(“”, $server ,$server, “FROM: test@”.$server); ?>