Difference between revisions of "PHP"

From Hostek.com Wiki
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
  
 
==PHP Versions==
 
==PHP Versions==
The current default PHP version on our servers is '''PHP 5.3'''. We also have '''PHP 5.4''' available.
+
We support all of the current PHP versions on both our Windows and Linux servers. This includes PHP versions 5.3, 5.4, 5.5 and 5.6. Our control panels allow you to choose which version of PHP you would like to use for your site.
===PHP Version - Windows===
+
===How to Change PHP Version===
You could control which version of PHP your site uses by going to the "PHP Settings" icon under "Website Settings".
+
====PHP Version - Windows====
===PHP Version - Linux===
+
Once logged into the control panel, click on "PHP Settings" icon under "Website Settings".
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.
+
====PHP Version - Linux====
 +
Login to cPanel and click on  "Select PHP Version" under "Software and Services". Choose the version from the drop-down menu and click on "Set as current"
 +
 
  
 
==Can I view the PHP configuration for my site?==
 
==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:
 
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 21: Line 23:
 
==mhash - Is the mhash library supported?==
 
==mhash - Is the mhash library supported?==
 
Yes, the mhash libary is supported with PHP.
 
Yes, the mhash libary is supported with PHP.
 +
 +
==magic-quotes - How can I disable magic-quotes?==
 +
To disable magic_quotes you will need to change the following lines in your php.ini from:
 +
 +
<pre>
 +
;magic_quotes_gpc = Off
 +
;magic_quotes_runtime = Off
 +
</pre>
 +
 +
'''To:'''
 +
 +
<pre>
 +
magic_quotes_gpc = Off
 +
magic_quotes_runtime = Off
 +
</pre>
  
 
==How can I use PHP to have a form email me the results?==
 
==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:
 
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 56:
 
\n";
 
\n";
 
}
 
}
?></nowiki>
+
?></syntaxhighlight>
  
  

Latest revision as of 19:22, 1 April 2015


Do you support PHP?

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

PHP Versions

We support all of the current PHP versions on both our Windows and Linux servers. This includes PHP versions 5.3, 5.4, 5.5 and 5.6. Our control panels allow you to choose which version of PHP you would like to use for your site.

How to Change PHP Version

PHP Version - Windows

Once logged into the control panel, click on "PHP Settings" icon under "Website Settings".

PHP Version - Linux

Login to cPanel and click on "Select PHP Version" under "Software and Services". Choose the version from the drop-down menu and click on "Set as current"


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.

magic-quotes - How can I disable magic-quotes?

To disable magic_quotes you will need to change the following lines in your php.ini from:

;magic_quotes_gpc = Off
;magic_quotes_runtime = Off 

To:

magic_quotes_gpc = Off
magic_quotes_runtime = Off 

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";
}
?>