Skip to content

PHP script basics

PHP is a server‑side scripting language that allows you to create dynamic web pages. On ruachost.com, PHP is preinstalled on all hosting accounts, making it easy to run scripts without additional setup.

  • PHP script files should be set to 755 permissions.
  • This ensures the user has read, write, and execute permissions, while the group and world have read and execute permissions.
  • Incorrect permissions may cause errors or prevent scripts from running.
  • Unlike Perl or Python, PHP scripts do not require a shebang line (#!/usr/bin/php).
  • You can run PHP scripts without adding this header.
  • Ruachost servers support PHP short tags.

  • Example:

    <? echo "Hello world"; ?>
  • Equivalent to:

    <?php echo "Hello world"; ?>
  • The absolute path to PHP on Ruachost servers is:

    /usr/bin/php
  • Since /usr/bin is in the default path, you can usually run scripts with:

    Terminal window
    php filename.php
  • Ruachost supports multiple PHP versions (5.6, 7.1–7.4, 8.0–8.4).

  • To check the command‑line version:

    Terminal window
    php -v
  • To check the web server version, log in to cPanel → Software → Select PHP Version.

  • Default extension: .php

  • You can define additional extensions (e.g., .html) in .htaccess:

    AddHandler application/x-httpd-lsphp .html
  • PHP safe mode is not enabled on Ruachost servers.
  • Safe mode was deprecated in PHP 5.3 and removed in PHP 5.4.
<?php
echo "Welcome to Ruachost!";
?>