Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8536915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:46:35+00:00 2026-06-11T10:46:35+00:00

im currently working on some sort of upload with automatic video conversion. At the

  • 0

im currently working on some sort of upload with automatic video conversion. At the moment i am executing a php script via php shell command after the upload is finished so the user doesn’t have to wait until the conversion is completed. Like so:

protected function _runConversionScript() {
    if (!exec("php -f '" . $this->_conversionScript . "' > /dev/null &"))
        return true;

    return false;
}

Now in my conversion script file i am using functions from another class “UploadFunctions” to update the status in the database (like started, converted, finished…). The problem there is though that this UploadFunctions class inherits from another class “Controller” where for example the database connection gets established. Currently i am using spl_autoloader to search specific directories for the files needed (for example controller.php), but because the conversion script is out of context with the whole autoloader stuff it doesn’t recognize the Controller class and throws an fatal php error.
Here is some code from the conversion script:

require_once('uploadfunctions.php');

$upload_func = new UploadFunctions();

// we want to make sure we only process videos that haven't already
// been or are being processed
$where = array(
    'status' => 'queued'
);
$videos = $upload_func->getVideos($where);

foreach ($videos as $video) {

    // update database to show that these videos are being processed
    $update = array(
        'id' => $video['id'],
        'status' => 'started'
    );
    // execute update
    $upload_func->updateVideo($update);
.........

Am i doing this completly wrong or is there a better way to accomplish this? If you need more code or information please let me know!
Thanks a lot

Here is my spl_autoload code:

<?php
spl_autoload_register('autoloader');

function autoloader($class_name) {
        $class_name = strtolower($class_name);

        $pos = strpos($class_name ,'twig');

        if($pos !== false){
            return false;
        }

        $possibilities = array(
            '..'.DIRECTORY_SEPARATOR.'globals'.DIRECTORY_SEPARATOR.$class_name.'.php',
            'controller'.DIRECTORY_SEPARATOR.$class_name.'.php',
            '..'.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.$class_name.'.php',
            'local'.DIRECTORY_SEPARATOR.$class_name.'.php'
        );

        foreach ($possibilities as $file) {

            if(class_exists($class_name) != true) {
                if (file_exists($file)) {

                    include_once($file);
                }
            }
        }
    }
?>

I have my project divided into subfolders wich represent the functionality, for example upload, myaccount and gallery.. in every subfolder there are also 2 other folders: controller and local. Controller is the class controlling this part (upload for example) and local is the folder where i am putting the local classes wich are needed. The controller class gets called from the index.php wich is located in the sub-project folder. “libs” and “global” are just projectwide classes, like database, user and so on.
This is an example of my folder structure:

www/index.php // main site

www/upload/index.php // calls the controller for upload and initializes the spl_autoload

www/upload/controller/indexcontroller.php // functionality for the upload

www/upload/local/processVideo.php // this is the conversion script.

I am fairly new to spl_autoload function. In my opinion the spl_autoload is not getting called if my script is calling: “php -f processVideo.php”, isn’t it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:46:36+00:00Added an answer on June 11, 2026 at 10:46 am

    I was actually able to resolve the issue. I had to include the spl_autoload_register function inside the conversion script so that it was able to locate the files. This was an issue because the conversion script is not build into my framework an so it isn’t able to load the classes from the framework autoloader.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

currently am working on some sort of dynamic loading library plugins development. The plugin
I'm currently working on some coding for a hotel booking widget and am using
I am currently working with some users that do not have the .NET Framework
I am currently working on some Ajax heavy code and I am wondering how
I'm currently working through some exercises in a c++ book, which uses text based
I am currently working on some simple custom allocators in c++ which generally works
I am currently working on some test cases for my website. I've managed to
I'm currently working on databinding some of my existing Windows Forms, and I've ran
Currently working on a VBScript to automate some of the dirty PST ingestion work
Some background I'm currently working on a mobile site so I keep switching user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.