Archive for the ‘php’ Category


Some times you might see there will be no /tmp file, instead it might be /tmps or /tmpz.

Then create /tmp folder and set 1777 permission.

Note: Here 1 is will set sticky bit.

Then set safemode off in main php.ini file.

You check the php.ini is located as #php -i |grep php.ini

Advertisements

PHP RECOMMENDED SETTINGS

Posted: February 3, 2013 in php

Clients wants to add below recommended settings as to run a software in the server:

1.You can get into /home/username/
2. vi php.ini
3. add below entries ( don’t add the bracket one which I mentioned below)

magic_quotes_gpc = Off
post_max_size = 60M (Maximum post size)
upload_max_filesize = 200M  (Maximum upload file size)
display_errors = Off   (Display Errors)
short_open_tag = off  ( Short Open Tag)
session.cookie_httponly = 1  (Cookie HTTP Only)

Screenshot

SAMPLE PHP SCRIPT FOR SENDING MAILS

Posted: February 3, 2013 in php

<?php

$Subject=”Trying to send”;
$Sender=”testing@betsexperts.com”;
$SendTo=”testmail4us@gmail.com”;
$Message2=”Testing mail”;

if(mail($SendTo, $Subject, $Message2, “From: $Sender”)){
print”<br><br><FONT style=\”font-size:12px\” color=\”#009300\” face=\”Arial\”><B>Sent to: $SendTo  … Sender: $Sender</B></FONT>”;
}else{
print”<br><br><FONT style=\”font-size:12px\” color=\”#FF0000\” face=\”Arial\”><B>Not sent to: $SendTo  … Sender: $Sender</B></FONT>”;
}

?>

Tips to remember:

Step 1:
Create a test.php inside public_html folder
For example —>  /home/public_html/test.php
Step2:
Copy the above script and paste inside test.php  (remember to change the ownership of test.php)
Step3:
run the url 
For example—> if you are creating test.php in your website http://example.com
Run the url as http://example.com/test.php
The mail will automatically send as php


This was very interesting fix for me. I have investigate this issue and fixed it temporary. One of our clients came across issue with his contact form is not working. He is getting error message as “cannot submit email”. His two of the domain or accounts also having same issue.

Step 1:
—>Check which site builder is using
—> If it is Joomla site builder ask their admin login details
—> Login as admin

Step 2:
Here is how to change from PHP Mail Function to Sendmail:

1. Log in as an admin on the backend of your joomla (http://localhost/”name_of_your_site”/administrator)
2. On the menu bar (on top) go to Site > Global Configuration
3. You’ll see on left side three links “Site | System | Server” (Right under “Global Configuration” phrase)
4. Click on the Server
5. Then find on your right “Mail Settings” box
6. In the Mailer drop down menu change from PHP Mail Function to Sendmail

For example :

Mailer: PHP mail function
Mail from: info@mydomain.com
From Name:  My Name
Sendmail Path /usr/sbin/sendmail
SMTP Authentication No

Step3:
Make sure the above settings is perfect.

Now the real solution is given below:

a. Locate /home/username/public_html/libraries/phpmailer

b. vi phpmailer.php

c. An incorrect argument $params is being passed to the mail() function at line 769

The line needs to be edited to remove this parameter.
Change:
Code:
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
to
Code:
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);

mod_rewrite, php version, mysql version

Posted: February 3, 2013 in php

mod_rewrite

for example :
==

root@server [~]# httpd -l |grep mod_rewrite
mod_rewrite.c

==
PHP version
========
==
root@server [~]# php -v
PHP 5.3.10 (cli) (built: Apr  6 2012 23:09:37)
==
mysql version
=====
==
root@server [~]# mysql -V
mysql  Ver 14.14 Distrib 5.1.66
==