PHP/MariaDB/MySQL

I am having problems with a script I wrote

Updated November 2026 12,455 views 4 min read
Scripts | Updated November 2026

If a script you wrote or installed is not working on your hosting account, this guide walks you through the most common causes and how to fix them. These steps apply to PHP, Perl, Python, and other server-side scripts on Ultra Web Hosting.

First Step: Check the Error Log

Before anything else, check your error log in cPanel > Metrics > Errors. The error message will tell you exactly what line of code is failing and why. Most script problems can be diagnosed from the error log in under a minute.

01. Check Your Error Logs

Your hosting account has two error logs you should check:

  • cPanel Error Log - go to cPanel > Metrics > Errors. Shows the most recent PHP, Perl, and CGI errors
  • Raw error_log file - PHP errors are also written to an error_log file in the same directory as your script. Check via File Manager or FTP

If errors are not appearing, you may need to enable error logging. Add this to the top of your PHP script for debugging:

ini_set('display_errors', 1);
ini_set('log_errors', 1);
error_reporting(E_ALL);
Remove Debug Code Before Going Live

Displaying errors on a production website exposes file paths and database details that attackers can exploit. Use display_errors only during development. On production, set display_errors = Off and rely on log_errors instead.

02. File Permissions

Incorrect permissions are one of the most common causes of script failures:

  • PHP files: 644 (owner read/write, group and world read)
  • Directories: 755 (owner full, group and world read/execute)
  • CGI/Perl scripts: 755 (must be executable)
  • Configuration files with passwords: 600 or 640 (restrict access)
Permission Rule

On our CloudLinux servers, never set files to 777. The server is configured to reject files with world-writable permissions as a security measure. If a tutorial tells you to use 777, use 755 for directories and 644 for files instead.

03. PHP Version Compatibility

If your script was written for an older PHP version, it may fail on newer versions due to removed functions or changed behavior. Common issues:

  • mysql_* functions (e.g., mysql_connect) were removed in PHP 7.0. Use mysqli_* or PDO instead
  • each() function was removed in PHP 8.0
  • Implicit nullable parameters cause deprecation warnings in PHP 8.4+
  • Short open tags (<? without php) may be disabled

You can change your PHP version in cPanel. See How to Change Your PHP Version.

04. File Paths and Includes

Hardcoded paths from another server will not work here. Common path issues:

  • Document root: /home/username/public_html/
  • Use absolute paths in includes: include('/home/username/public_html/config.php');
  • Or use relative paths with __DIR__: include(__DIR__ . '/config.php');

For the full list of server paths, see Server Paths - PHP, Perl, Python, and More.

05. Common Script Errors

  • 500 Internal Server Error - syntax error, wrong permissions, or .htaccess conflict. See Error 500 guide
  • 403 Forbidden - wrong permissions or mod_security blocking. See 403 error guide
  • Blank white page - PHP fatal error with display_errors turned off. Check the error log
  • "Class not found" or "Function undefined" - missing PHP extension. Most are enabled by default; if one you need is missing, open a support ticket and we'll enable it
  • open_basedir restriction - your script is trying to read files outside your home directory. See open_basedir fix
  • Form not sending email - see Why Does My Form Not Send Email

06. Shared Hosting Restrictions

Shared hosting has certain restrictions to protect all users on the server:

  • exec(), system(), passthru() are disabled. See disabled functions guide
  • Memory limit: 384MB per PHP process
  • Max execution time: 120 seconds default
  • File upload size: configurable via MultiPHP INI Editor or .htaccess
  • No root access - you cannot install system packages or modify server configuration

If your script needs more resources, consider upgrading to a VPS or dedicated server.

Still Stuck?

If you have checked the error log and tried the steps above, open a support ticket with the exact error message and we will help you diagnose the issue.

Open a Support Ticket

Frequently Asked Questions

How do I debug a script that is not working?

Check the error log first. In cPanel open Metrics then Errors, or read the error_log file in the script's directory. The last entries name the exact error, so you fix the real cause instead of guessing. This applies to PHP, Perl, and Python scripts.

Why does my script return a 500 error?

Common causes are a syntax or fatal error in the code, wrong file permissions, an unsupported PHP version, or a bad include path. The error_log pinpoints which. Scripts usually need 644 permissions and CGI scripts 755.

Could the PHP version be breaking my script?

Yes. Older code can fail on a newer PHP version and vice versa. Set the PHP version your script needs in cPanel under Select PHP Version, then test. Many script errors after a move trace back to a PHP version mismatch.

Why does my script work elsewhere but not on shared hosting?

Shared hosting disables risky functions like exec and system and restricts file access to your account via open_basedir. A script that shells out or reaches outside its directory will fail here. Rework it to stay within your account, or use a VPS for full control.

Quick Recap: Script Troubleshooting

  1. Check the error log in cPanel > Metrics > Errors first
  2. Verify permissions are 644 for files, 755 for directories
  3. Check PHP version compatibility in cPanel > MultiPHP Manager
  4. Fix file paths to match your hosting account structure
  5. Review restrictions if your script needs functions not available on shared hosting

11,872 users found this article useful · Last updated November 2026 · Browse all PHP/MySQL articles

Share: X in Reddit f Email
  • 592 Users Found This Useful

Was this answer helpful?

Related Articles

How can I find my MariaDB - MySQL version?

PHP/MariaDB/MySQL | Updated March 2026 There are several ways to check your MariaDB/MySQL...

PHP information

PHP/MySQL | Updated January 2026 To view your PHP version, loaded extensions, configuration...

The MySQL Server Is Currently Offline - DBCACHE Exit 11

Server Maintenance | Updated March 2026 When cPanel displays "The MySQL server is currently...

How Do I Update or Change My PHP Version

Hosting Control Panel | Updated October 2026 Ultra Web Hosting runs CloudLinux with multiple...

Cannot Connect to MariaDB MySQL Database

PHP/MariaDB/MySQL | Updated November 2026 The "Could not connect to the database" error means...



Save 30% on web hosting - Use coupon code Hosting30