Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Saturday, February 13, 2010

Optimize PHP Linux Web Server

Open php.ini configuration file.
vi /etc/php.ini
Find and change to following value:-
max_execution_time = 30
max_input_time = 30
memory_limit = 40M
post_max_size = 8M
upload_max_filesize = 2M
file_uploads = Off (Turn off if it really not use.)
cgi.force_redirect = 0
allow_url_fopen = Off
sql.safe_mode = Off
Reload Apache, using following command:-
server httpd reload
or
/etc/init.d/httpd reload

Saturday, March 28, 2009

Install Suhosin as extension / PHP harden

Download the latest version of suhosin:-

wget http://download.suhosin.org/suhosin-0.9.27.tgz


Suhosin required php-devel:-

yum install php-devel


Install suhsosin:-

cd suhosin-0.9.27
phpize
./configure
make
make install


Congfirue Suhosin congiguration file:-

echo 'extension=suhosin.so' > /etc/php.d/suhosin.ini


Restart your webserver..
blockquote>
/etc/init.d/httpd restart

Check your suhsosin:-
php -v

or crate phpinfo page.

Friday, February 06, 2009

How to do redirect page

How to do redirect page?

PHP
<?php
header("Location: http:/harithdawi.com/");
exit();
?>

ASP
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://harithdawi.com/"
%>

ASP.NET
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://harithdawi.com/");
}
</script>

JAVA (JSP)

<%
response.setStatus(301);
response.setHeader( "Location", "
http://harithdawi.com/" );
response.setHeader( "Connection", "close" );
%>

.HTACCESS (redirect all from old domain to  new domain)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://harithdawi.com/$1 [R=301,L]

JAVA SCRIPT
<script type="text/javascript">
<!--
window.location = "http://harithdawi.com/"
//-->
</script>