I need to upload a PHP bigger than 1mb

I really need it uploading its a library for like thje main settings of my website i would really appreciate it if anyone could upload it for me or tell me how to make it smaller tysm :slight_smile:

You can split it into multiple files and use

require_once()

9 Likes

bro i have no clue how to do that can you do it?

You can split different parts of your PHP code and then use include[_once] or require[_once]:

<?php
...
include "splitfile.php";
include "splitfile2.php";

Or

...
require "splitfile.php";
require "splitfile2.php";

The main difference between include and require is that require will stop executing when it encounters an error by throwing a fatal error while include doesn’t.

Lastly, the difference between the _once version is that if you already included or required that file before, it won’t include it again which will prevent some errors.

include "config.php";
...
include_once "config.php"; // This won't do anything

https://www.php.net/manual/en/function.require-once.php
https://www.php.net/manual/en/function.include-once.php

9 Likes

i made the file into 982kb but it still wont upload, why???

What’s the error?

8 Likes

You probably need to compress it more, since it is around 1MiB so anything under 950KB should be fine.

8 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.