Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forking is not supported on this platform #238

Open
Michael-King9812 opened this issue Dec 21, 2024 · 1 comment
Open

forking is not supported on this platform #238

Michael-King9812 opened this issue Dec 21, 2024 · 1 comment
Assignees

Comments

@Michael-King9812
Copy link

Describe the bug

Hi please, this is really urgent, I keep getting the error message: "forking is not supported on this platform" anything I try save data into firestore database, am not having issues with realtime database, the man issue is on firestore, and after receiving this error message, it automatically terminate my laravel server, I will have to restart the server before I could do any thing again. It keeps returning me to the following page in the attached file
Screenshot (375)

That is the error am getting, I could not even get any solid error message to debug, that's all I keep getting.

Installed packages

{
    "$schema": "https://getcomposer.org/schema.json",
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": ["laravel", "framework"],
    "license": "MIT",
    "require": {
        "php": "^8.2",
        "google/cloud-firestore": "^1.47",
        "kreait/laravel-firebase": "^5.10",
        "laravel/framework": "^11.31",
        "laravel/tinker": "^2.9"
    },
    "require-dev": {
        "fakerphp/faker": "^1.23",
        "laravel/pail": "^1.1",
        "laravel/pint": "^1.13",
        "laravel/sail": "^1.26",
        "mockery/mockery": "^1.6",
        "nunomaduro/collision": "^8.1",
        "phpunit/phpunit": "^11.0.1"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi",
            "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
            "@php artisan migrate --graceful --ansi"
        ],
        "dev": [
            "Composer\\Config::disableProcessTimeout",
            "npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}

PHP version and extensions

Php version: 8.2

$ composer show --platform
composer               2.7.7    Composer package
composer-plugin-api    2.6.0    The Composer Plugin API   
composer-runtime-api   2.2.2    The Composer Runtime API  
ext-bcmath             8.2.12   The bcmath PHP extension  
ext-bz2                8.2.12   The bz2 PHP extension     
ext-calendar           8.2.12   The calendar PHP extension
ext-ctype              8.2.12   The ctype PHP extension   
ext-curl               8.2.12   The curl PHP extension    
ext-date               8.2.12   The date PHP extension    
ext-dom                20031129 The dom PHP extension     
ext-exif               8.2.12   The exif PHP extension
ext-fileinfo           8.2.12   The fileinfo PHP extension
ext-filter             8.2.12   The filter PHP extension
ext-ftp                8.2.12   The ftp PHP extension
ext-gettext            8.2.12   The gettext PHP extension
ext-grpc               1.68.0   The grpc PHP extension
ext-hash               8.2.12   The hash PHP extension
ext-iconv              8.2.12   The iconv PHP extension
ext-json               8.2.12   The json PHP extension
ext-libxml             8.2.12   The libxml PHP extension
ext-mbstring           8.2.12   The mbstring PHP extension
ext-mysqli             8.2.12   The mysqli PHP extension
ext-mysqlnd            0        The mysqlnd PHP extension (actual version: mysqlnd 8.2.12)
ext-openssl            8.2.12   The openssl PHP extension
ext-pcre               8.2.12   The pcre PHP extension
ext-pdo                8.2.12   The PDO PHP extension
ext-pdo_mysql          8.2.12   The pdo_mysql PHP extension
ext-pdo_sqlite         8.2.12   The pdo_sqlite PHP extension
ext-phar               8.2.12   The Phar PHP extension
ext-random             8.2.12   The random PHP extension
ext-readline           8.2.12   The readline PHP extension
ext-reflection         8.2.12   The Reflection PHP extension
ext-session            8.2.12   The session PHP extension
ext-simplexml          8.2.12   The SimpleXML PHP extension
ext-sodium             8.2.12   The sodium PHP extension
ext-spl                8.2.12   The SPL PHP extension
ext-tokenizer          8.2.12   The tokenizer PHP extension
ext-xml                8.2.12   The xml PHP extension
ext-xmlreader          8.2.12   The xmlreader PHP extension
ext-xmlwriter          8.2.12   The xmlwriter PHP extension
ext-zip                1.21.1   The zip PHP extension
ext-zlib               8.2.12   The zlib PHP extension
lib-bz2                1.0.8    The bz2 library
lib-curl               8.4.0    The curl library
lib-curl-libssh2       1.10.0   curl libssh2 version
lib-curl-openssl       3.0.11   curl OpenSSL version (3.0.11)
lib-curl-zlib          1.2.12   curl zlib version
lib-date-timelib       2022.09  date timelib version
lib-date-zoneinfo      2023.3   zoneinfo ("Olson") database for date
lib-fileinfo-libmagic  540      fileinfo libmagic version
lib-iconv              1.16     The iconv library
lib-libsodium          1.0.18   The libsodium library
lib-libxml             2.10.3   libxml library version
lib-mbstring-libmbfl   1.3.2    mbstring libmbfl version
lib-mbstring-oniguruma 6.9.8    mbstring oniguruma version
lib-openssl            3.0.11   OpenSSL 3.0.11 19 Sep 2023
lib-pcre               10.40    The pcre library
lib-pcre-unicode       14.0.0   PCRE Unicode version support
lib-pdo_sqlite-sqlite  3.39.2   The pdo_sqlite-sqlite library
lib-zip-libzip         1.7.1    The zip-libzip library
lib-zlib               1.2.12   The zlib library
php                    8.2.12   The PHP interpreter
php-64bit              8.2.12   The PHP interpreter, 64bit
php-ipv6               8.2.12   The PHP interpreter, with IPv6 support
php-zts                8.2.12   The PHP interpreter, with Zend Thread Safety

Steps to reproduce the issue.

# Insert the commands issued in the terminal if they are needed
# to reproduce the issue. Otherwise, delete this code block.
<?php

namespace App\Services;

use Google\Cloud\Firestore\FirestoreClient;

class FirestoreService
{
    protected $firestore;
    

    public function __construct()
    {
        $this->firestore = new FirestoreClient([
            'keyFilePath' => public_path('secret.json'), // Path to the service account file
        ]);

        print_r($this->firestore->collection('test')->documents());
        exit();
    }

    public function storeData($collection, $data)
    {
        $this->firestore->collection($collection)->add($data);
    }

    public function getData($collection)
    {
        $documents = $this->firestore->collection($collection)->documents();
        $data = [];

        foreach ($documents as $document) {
            if ($document->exists()) {
                $data[] = array_merge(['id' => $document->id()], $document->data());
            }
        }

        return $data;
    }

    public function updateData($collection, $id, $data)
    {
        $this->firestore->collection($collection)->document($id)->set($data, ['merge' => true]);
    }

    public function deleteData($collection, $id)
    {
        $this->firestore->collection($collection)->document($id)->delete();
    }
}
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Services\FirestoreService;

class FirestoreController extends Controller
{
    protected $firestore;

    public function __construct(FirestoreService $firestore)
    {
        $this->firestore = $firestore;
    }

    public function index()
    {
        return view("firestore");
    }

    public function store(Request $request)
    {
        $validatedData = $request->validate([
            'name' => 'required|string|max:255',
            'email' => 'required|email',
        ]);
        
        $this->firestore->storeData('users', $validatedData);

        return response()->json(['message' => 'Data stored successfully']);
    }

    public function fetch()
    {
        $data = $this->firestore->getData('users');

        return response()->json($data);
    }

    public function update(Request $request, $id)
    {
        $validatedData = $request->validate([
            'name' => 'sometimes|string|max:255',
            'email' => 'sometimes|email',
        ]);

        $this->firestore->updateData('users', $id, $validatedData);

        return response()->json(['message' => 'Data updated successfully']);
    }

    public function delete($id)
    {
        $this->firestore->deleteData('users', $id);

        return response()->json(['message' => 'Data deleted successfully']);
    }
}

Error message/Stack trace

no error stack trace returned

Additional information

No response

@jeromegamez
Copy link
Member

jeromegamez commented Dec 21, 2024

Your PHP installation is missing the PCNTL extension.

https://www.php.net/manual/en/book.pcntl.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants