Archive for the Category »Enable private PHP «

Send mail by using phpmail function.

You can create a simple php mail form by using following code..

————————–

<?
$to      = ’supp0rt@xyz.com’;
$subject = ‘The test for mail function’;
$message = ‘Hello’;
$headers = ‘From: test@abc123.com’ . “\r\n” .
‘Reply-To: test@testforever123.com’ . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();
mail($to, $subject, $message, $headers);
?>

————————–

If you are not able to receive the E-mail then you need to check whether your server is allowing to send an E-mail by using phpmail() or not?’ if you are having root login then check the servers main php.ini file.

root@Gunjan []# php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

root@Gunjan []# cat /usr/local/lib/php.ini | grep disable_function
disable_functions=”system,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,highlight_file,phpmail”

and remove the phpmail() from server mail php.ini file and restart the Apache web server.

Or

If you are not having root login details then contact your hosting provider and ask them to enable the phpmail() for your hosting account.

You can also send me an E-mail at nsk.gunjan@gmail.com if you have any queries…

How to disbale Directory listing for folders?

To disable the Directory listing for folders you need to create the .htaccess file under the each an every folder under which you want to disable the Directory listing and insert the following code in .htaccess file.

————
Options -Indexes
————

Please contact us if you have any problem or queries…..

Enable private PHP Error Logging by using .htaccess file

To hide the PHP errors from visitors insert the following code in .htaccess file

# Disable php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off

Once disable the error logs for visitors enable the private PHP error logging by using following code in the .htaccess file

# enable PHP error logging
php_flag log_errors on
php_value error_log /home/path/public_html/domain/PHP_errors.log

The PHP_errors.log file needs to be permission 755 or 777.