Manuals
RU EN

Start · 22

PHP and MySQL Requirements for a Script

Start 6 min read

Requirements are what decide whether a script installs or fails with a Fatal Error on the first file. "Hosting with PHP" without a version and extensions is not a requirement. Shared hosting often shows PHP 7.4 by default while you are uploading a release for 8.1, and then the white screen is no surprise.

Below is the minimum we use for Microscript products. A specific archive may need a little more, such as intl or zip, so read the included readme. But the base list here cannot be ignored.

PHP version

PHP 8.x is required. Not 5.6 because it worked on an old local server. Not unsupported 7.0. The working branches we use are 8.1-8.3. If the host offers only 7.4 and says "we will update soon", change the plan or host, or use a VDS where you control the version.

Check on the server:

php -v
php -m

Panels such as Beget, Timeweb, and ISPmanager usually have a version selector per domain. After selecting 8.2 for the site, make sure CLI for cron is also 8.2 and not the system 7.x from /usr/bin/php. Otherwise the web side works while cron jobs fail on syntax.

Locally, MicroServer already includes PHP 8. The old local-server alternative is described separately: Denwer PHP 8.

Extensions

Without these, the installer or admin area will fail badly:

  • mysqli - the main MySQL/MariaDB connection. PDO may exist nearby, but our scripts rely on mysqli.
  • mbstring - strings, search, and emails. Without it, some functions damage non-ASCII text.
  • json - usually built into the core, but check custom builds.
  • gd or imagick - previews and upload resizing. Shared hosting usually has gd.
  • curl - external APIs, payments, and webhooks.
  • openssl - outbound HTTPS requests and parts of authorization.

Less common but still seen: zip, xml, intl, fileinfo. If the log says Call to undefined function ..., look at the function name and install the module instead of "reinstalling the script".

Also check limits in php.ini:

  • upload_max_filesize and post_max_size - otherwise listing photos will not fit.
  • memory_limit - 128M is often too low for heavy imports; 256M is calmer.
  • max_execution_time - long admin operations.

MySQL / MariaDB

MySQL 5.7+/8.x or MariaDB 10.3+ is suitable. Database and table charset should be utf8mb4. If you create a database in latin1 because the panel suggested it, you will later repair dumps and broken text.

The database user needs SELECT/INSERT/UPDATE/DELETE/CREATE/ALTER/INDEX on its own database. During installation the script creates tables, so without CREATE it will not start. On shared hosting, the panel usually grants the required set with checkboxes.

Connection host:

  • locally: 127.0.0.1 (sometimes localhost uses a socket; both are fine if the service listens);
  • on shared hosting: the value from the database card, not always localhost;
  • from outside a VDS, it is better not to expose MySQL; see firewall.

File and directory permissions

The web user (www-data, apache, nobody, depending on the host) must be able to write to upload, cache, tmp, and similar directories from the package. Directories 755 and files 644 are the baseline. Detailed guide: chmod for a script.

Keep the database password config away from unnecessary access. If the script stores config in the public root, do not make it world-writable.

Web server

Apache with mod_rewrite or Nginx plus PHP-FPM. On Nginx, .htaccess rules are not applied automatically; they must be translated into the server config. Base stack: Nginx + PHP-FPM.

Clean URLs and the admin area need working rewrite. If only the homepage opens and internal URLs return 404, the issue is usually rewrite, not "broken PHP".

Cron and mail

Many products need cron: queues, VIP removal, cleanup. On shared hosting, check whether cron is included in the plan and what path points to php-cli. Manual: cron jobs.

Mail: mail() on shared hosting may work or land in spam. For production, use SMTP. This is not strictly a "PHP requirement", but without mail, registration forms look dead.

Quick checklist before upload

  1. PHP 8.x for the domain and CLI.
  2. php -m shows mysqli, mbstring, gd/imagick, curl.
  3. Empty utf8mb4 database, user attached.
  4. Document root points to the script root.
  5. Upload directories are writable.

If the database does not connect during installation, see MySQL connection error. General upload process: script installation. Unsure about a plan: which hosting to choose.

phpinfo() temporarily. On shared hosting, it is convenient to upload phpinfo once, check modules, and delete the file. Do not leave it in the root forever; it exposes a server map to outsiders.

How to collect phpinfo safely

Create info.php with <?php phpinfo();, open it, check modules, delete it. Do not leave it under an obvious name. On a VDS, checking modules through CLI is preferable.

Difference between web PHP and CLI PHP

The panel may select 8.2 for the site while php -v over SSH shows 7.4. Web installation succeeds, cron on CLI does not. Use the full path to php82 in cron: cron. On local Windows, the same problem appears with multiple php.exe files: Composer, MicroServer.

short_open_tag and outdated options

Modern scripts should not require short_open_tag. If old custom code contains it, rewrite the tags instead of enabling short tags on the whole server. magic_quotes is long gone; throw away guides that still configure it.

Timeouts and sessions

Besides memory_limit, check session.gc_maxlifetime if users complain about quick logout. It is not always a script bug. Load balancers with multiple nodes and no sticky sessions can also create surprises, though this is not relevant to a single VDS.

Checklist for host or admin

You can forward this list:

  • PHP 8.1+ for the domain;
  • mysqli, mbstring, curl, gd, openssl, json;
  • MySQL/MariaDB and the ability to create a utf8mb4 database;
  • cron with CLI of the same PHP version;
  • write access to upload/cache directories;
  • upload limit at least 16-32M for photos.

If the answer is "no" to everything, choose another plan or VDS / root. Comparison: hosting.

Related failures

Database does not connect: MySQL error. 500 after installation: 500 error. Permissions: chmod. Installation: installation. Local replacement for Denwer: Denwer PHP 8. Production web on Nginx: Nginx + PHP-FPM.

FAQ

Php mysql requirements for script?

Before installation, check PHP 8, mysqli, and write permissions. Otherwise the installer will stop at the first step.

How long does “PHP and MySQL Requirements for a Script” take?

About 6 minutes to read. In practice it depends on your hosting and database setup.

Do I need a dedicated server?

For most scripts, shared hosting or a VDS with PHP and MySQL is enough. See the VDS section and PHP/MySQL requirements.

How to install a php script on hosting?

See the related manual for this query. how to install a php script on hosting

Database connection error when installing a script?

See the related manual for this query. database connection error when installing a script

Section
Installing a PHP script

From server requirements to SSL and cron — every manual for launching a ready-made PHP script.