Showing posts with label Configuration Php. Show all posts
Showing posts with label Configuration Php. Show all posts

.htaccess redirect url example


If I want to direct the non-www version of whhsupport.com to the www version I would place the following code into my .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^whhsupport.com
RewriteRule (.*) http://www.whhsupport.com/$1 [R=301,L]

Conversely, if I want to direct the www version of whhsupport.com to the non-www version, I would enter the following code into my .htaccess file:
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www\.whhsupport\.com$ [NC]
RewriteRule ^(.*)$ http://whhsupport.com/$1 [R=301,L]

E-mail confuguration in Php

Mail Configuration in Php

The mail() function allows you to send mails from a script directly

PHP requires an installed and working email system for the mail function to work well. It works by the configuration settings in the php.ini file.

The mail() functions is part of the PHP core. There is no installation needed to use these functions.

Configuration

we can set mail() function configurations in php.ini file with the directives as below.

Name Default Description
SMTP "localhost" (Windows) The DNS name or IP address of the SMTP server
smtp_port "25" (Windows) The SMTP port number.
sendmail_from NULL (Windows)Specifies the "from" address to be used in email sent from PHP
sendmail_path NULL (Linux): Specifies where the sendmail program can be found ( /usr/sbin/sendmail or /usr/lib/sendmail)

Php mail() Example

Most Frequently used php configuration directives : php.ini


Below are the most frequntly used php directives.
You have to change php.ini file for making confuguration level setting.
This just means changing these directive’s option and value.

Php.ini file is configuration file for php, You can find the location of php.ini file from
Go to http://locahost/xamp and the click phpinfo()

1) short_open_tag = Off

 This will not allow the shout tags like , if this is set off

2) max_execution_time = 30

Maximum execution time of th script, in seconds

3) error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

This shows all errors, except coding standards warnings. Some more examples for
error_reporting setting:
- Show all errors, except for notices and coding standards warnings
error_reporting = E_ALL & ~E_NOTICE
- Show all errors, except for notices
error_reporting = E_ALL & ~E_NOTICE | E_STRICT
- Show only errors
error_reporting= E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

4) display_errors = On

Print errors (as a part of the output). For production web sites turn this feature off, and use error logging instead (see below). Keeping display_errors enabled on a production web site may reveal security information to end users, such as file paths on your Web server, your database schema or other information.

5) log_errors = On

Create Log of errors into a log file (server-specific log, or error_log). You should use error logging in place of error displaying on production web sites.

6) register_globals = Off

You should do your best to write your scripts so that they do not require register_globals to be on.
Using form variables as globals can easily lead to possible security problems, if the code is not very well. Making register_global  on can make securitry hole.

7) memory_limit = 128M

This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server.

8) post_max_size = 8M

Maximum size of POST data that PHP will accept. In the above example Post max size is 8MB.
This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is set by your configure script, memory_limit also affects file uploading. Generally , memory_limit should be more than post_max_size .

9) file_uploads = On

Allow HTTP file uploads or not.

10) upload_max_filesize = 2M

Maximum allowed size for uploaded files. Default is  2MB.

11) allow_url_fopen = On

Allow the treatment of URLs (like http:// or ftp://) as files if on.