Difference between revisions of "PHP"

From Hostek.com Wiki
Jump to: navigation, search
Line 14: Line 14:
 
Yes, to do this you'll just need to create a .php file with the following code and browse to the file:
 
Yes, to do this you'll just need to create a .php file with the following code and browse to the file:
  
<pre><?php phpinfo(); ?></pre>
+
<syntaxhighlight lang="php"><?php phpinfo(); ?></syntaxhighlight>
  
 
==Do you support cURL in PHP?==
 
==Do you support cURL in PHP?==
Line 25: Line 25:
 
Here is a sample PHP script that uses submitted form information to send an email:
 
Here is a sample PHP script that uses submitted form information to send an email:
  
<nowiki><?php
+
<syntaxhighlight lang="php"><?php
 
if ($_POST['to'] && $_POST['from']) {
 
if ($_POST['to'] && $_POST['from']) {
 
$headers .= "MIME-Version: 1.0\r\n";
 
$headers .= "MIME-Version: 1.0\r\n";
Line 39: Line 39:
 
\n";
 
\n";
 
}
 
}
?></nowiki>
+
?></syntaxhighlight>
  
  

Revision as of 17:35, 23 May 2013


Do you support PHP?

Yes, we support PHP on all of our Windows and Linux hosting servers.

PHP Versions

The current default PHP version on our servers is PHP 5.3. We also have PHP 5.4 available.

PHP Version - Windows

You could control which version of PHP your site uses by going to the "PHP Settings" icon under "Website Settings".

PHP Version - Linux

PHP 5.3 is the default unless you request otherwise. If you need PHP 5.4 please request it when ordering hosting. If you are an existing customer, contact our support department to have your site moved to a PHP 5.4 server.

Can I view the PHP configuration for my site?

Yes, to do this you'll just need to create a .php file with the following code and browse to the file:

<?php phpinfo(); ?>

Do you support cURL in PHP?

Yes, we support cURL.

mhash - Is the mhash library supported?

Yes, the mhash libary is supported with PHP.

How can I use PHP to have a form email me the results?

Here is a sample PHP script that uses submitted form information to send an email:

<?php
if ($_POST['to'] && $_POST['from']) {
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$_POST['from']." <".$_POST['from'].">\r\n";
$headers .= "To: ".$_POST['to']." <".$_POST['to'].">\r\n";
$headers .= "Reply-To: ".$_POST['from']." <".$_POST['from'].">\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: A Server";
mail($_POST['to'], $_POST['subject'], $_POST['body'], $headers); echo
"Mail sent to ".$_POST['to'].".
\n";
}
?>