PHP websocket on synology

I would like to create a chat server placed on my Nas Synology DS212J accessible by internet. I am not very competent in the field but I understood that it was necessary to use “websocket”. I tried with Node.js but my nas does not allow me to install a fairly recent Node version apparently. So I am looking at “PHP Websocket”.
I managed to find a code on: https: //github.com/Flynsarmy/PHPWebSocket-Chat which I deposited in the / web / chatLogPat folder of my Nas.
I managed to launch server.php in SSH but when I connect to my Chat page, I cannot establish a connection … Putty (ssh) tells me all the time: “myconnectionIp has disconnected

Can you help me please?

my link to index.html is: https://serveurarchaux.synology.me/chatLogPat

My NAS is connected to my box in: 192.168.1.12

Here are my files:

server.php on web/chatLogPat

    <?php
// prevent the server from timing out
set_time_limit(0);

// include the web sockets server script (the server is started at the far bottom of this file)
require 'class.PHPWebSocket.php';

// when a client sends data to the server
function wsOnMessage($clientID, $message, $messageLength, $binary) {
    global $Server;
    $ip = long2ip( $Server->wsClients[$clientID][6] );

    // check if message length is 0
    if ($messageLength == 0) {
        $Server->wsClose($clientID);
        return;
    }

    //The speaker is the only person in the room. Don't let them feel lonely.
    if ( sizeof($Server->wsClients) == 1 )
        $Server->wsSend($clientID, "There isn't anyone else in the room, but I'll still listen to you. --Your Trusty Server");
    else
        //Send the message to everyone but the person who said it
        foreach ( $Server->wsClients as $id => $client )
            if ( $id != $clientID )
                $Server->wsSend($id, "Visitor $clientID ($ip) said "$message"");
}

// when a client connects
function wsOnOpen($clientID)
{
    global $Server;
    $ip = long2ip( $Server->wsClients[$clientID][6] );

    $Server->log( "$ip ($clientID) has connected." );

    //Send a join notice to everyone but the person who joined
    foreach ( $Server->wsClients as $id => $client )
        if ( $id != $clientID )
            $Server->wsSend($id, "Visitor $clientID ($ip) has joined the room.");
}

// when a client closes or lost connection
function wsOnClose($clientID, $status) {
    global $Server;
    $ip = long2ip( $Server->wsClients[$clientID][6] );

    $Server->log( "$ip ($clientID) has disconnected." );

    //Send a user left notice to everyone in the room
    foreach ( $Server->wsClients as $id => $client )
        $Server->wsSend($id, "Visitor $clientID ($ip) has left the room.");
}

// start the server
$Server = new PHPWebSocket();
$Server->bind('message', 'wsOnMessage');
$Server->bind('open', 'wsOnOpen');
$Server->bind('close', 'wsOnClose');
// for other computers to connect, you will probably need to change this to your LAN IP or external IP,
// alternatively use: gethostbyaddr(gethostbyname($_SERVER['SERVER_NAME']))
$Server->wsStartServer('192.168.1.12', 9300);


?>

index.html on web/chatLogPat

    <!doctype html>
<html>
<head>
    <meta charset='UTF-8' />
    <style>
        input, textarea {border:1px solid #CCC;margin:0px;padding:0px}

        #body {max-width:800px;margin:auto}
        #log {width:100%;height:400px}
        #message {width:100%;line-height:20px}
    </style>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="fancywebsocket.js"></script>
    <script>
        var Server;

        function log( text ) {
            $log = $('#log');
            //Add text to log
            $log.append(($log.val()?"n":'')+text);
            //Autoscroll
            $log[0].scrollTop = $log[0].scrollHeight - $log[0].clientHeight;
        }

        function send( text ) {
            Server.send( 'message', text );
        }

        $(document).ready(function() {
            log('Connecting...');
            Server = new FancyWebSocket('wss://serveurarchaux.synology.me:9300');

            $('#message').keypress(function(e) {
                if ( e.keyCode == 13 && this.value ) {
                    log( 'You: ' + this.value );
                    send( this.value );

                    $(this).val('');
                }
            });

            //Let the user know we're connected
            Server.bind('open', function() {
                log( "Connected." );
            });

            //OH NOES! Disconnection occurred.
            Server.bind('close', function( data ) {
                log( "Disconnected." );
            });

            //Log any messages sent from server
            Server.bind('message', function( payload ) {
                log( payload );
            });

            Server.connect();
        });
    </script>
</head>

<body>
    <div id='body'>
        <textarea id='log' name='log' readonly='readonly'></textarea><br/>
        <input type='text' id='message' name='message' />
    </div>
</body>

</html>

Oracle cloud linux Centos8 — when executing: yum install php-mysql get error! how to solve

yum install php-mysql
Failed loading plugin “osmsplugin”: No module named ‘librepo’
Last metadata expiration check: 0:01:56 ago on Mon 10 Jan 2022 10:31:23 AM GMT.
Error:
Problem: conflicting requests

  • package php55w-mysql-5.5.38-1.w7.x86_64 requires php55w-pdo(x86-64), but none of the providers can be installed
  • package php56w-mysql-5.6.40-1.w7.x86_64 requires php56w-pdo(x86-64), but none of the providers can be installed
  • package php70w-mysql-7.0.33-1.w7.x86_64 requires php70w-pdo(x86-64), but none of the providers can be installed
  • package php71w-mysql-7.1.26-1.w7.x86_64 requires php71w-pdo(x86-64), but none of the providers can be installed
  • package php71w-mysql-7.1.27-1.w7.x86_64 requires php71w-pdo(x86-64), but none of the providers can be installed
  • package php71w-mysql-7.1.28-1.w7.x86_64 requires php71w-pdo(x86-64), but none of the providers can be installed
  • package php71w-mysql-7.1.29-1.w7.x86_64 requires php71w-pdo(x86-64), but none of the providers can be installed
  • package php71w-mysql-7.1.30-1.w7.x86_64 requires php71w-pdo(x86-64), but none of the providers can be installed
  • package php71w-mysql-7.1.31-1.w7.x86_64 requires php71w-pdo(x86-64), but none of the providers can be installed
  • package php71w-mysql-7.1.32-1.w7.x86_64 requires php71w-pdo(x86-64), but none of the providers can be installed
  • package php71w-mysql-7.1.33-1.w7.x86_64 requires php71w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.14-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.16-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.17-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.19-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.21-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.22-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.24-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.27-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.31-2.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.32-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php72w-mysql-7.2.34-1.w7.x86_64 requires php72w-pdo(x86-64), but none of the providers can be installed
  • package php55w-pdo-5.5.38-1.w7.x86_64 is filtered out by modular filtering
  • package php56w-pdo-5.6.40-1.w7.x86_64 is filtered out by modular filtering
  • package php70w-pdo-7.0.33-1.w7.x86_64 is filtered out by modular filtering
  • package php71w-pdo-7.1.26-1.w7.x86_64 is filtered out by modular filtering
  • package php71w-pdo-7.1.27-1.w7.x86_64 is filtered out by modular filtering
  • package php71w-pdo-7.1.28-1.w7.x86_64 is filtered out by modular filtering
  • package php71w-pdo-7.1.29-1.w7.x86_64 is filtered out by modular filtering
  • package php71w-pdo-7.1.30-1.w7.x86_64 is filtered out by modular filtering
  • package php71w-pdo-7.1.31-1.w7.x86_64 is filtered out by modular filtering
  • package php71w-pdo-7.1.32-1.w7.x86_64 is filtered out by modular filtering
  • package php71w-pdo-7.1.33-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.14-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.16-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.17-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.19-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.21-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.22-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.24-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.27-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.31-2.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.32-1.w7.x86_64 is filtered out by modular filtering
  • package php72w-pdo-7.2.34-1.w7.x86_64 is filtered out by modular filtering
    (try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)

Why Laravel cannot subscribe to PrivateChannel over Laravel Echo?

In my Laravel 8 project, I use laravel-websockets to send messages over websocket, laravel echo to receive messages. If I use Channel class for broadcasting, everything works great whereas I use PrivateChannel, socket connection can be established, yet no subscription is done. Hence I cannot send/receive message over websocket, but ping/pong messages can be seen on inspector of browser.

Most of stackoverflow questions were replied according to static named channels, but I have dynamic named channels that belongs to each users.

You can see my related code blocks below.

<app.php>

AppProvidersBroadcastServiceProvider::class //ADDED-to providers

<BroadcastServiceProvider.php>

Broadcast::routes(['middleware' => 'auth:sanctum']); //ADDED-auth by sanctum

<channels.php>

Broadcast::channel('task-emmiter{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});
//ADDED

<MessageManager.php>

public function broadcastOn()
{
    //Channel works, PrivateChannel not
    return new PrivateChannel('task-emmiter'.$this->receiver); 
}

<websocket.js>

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'ABCDEFG',
    wsHost: window.location.hostname,
    wsPort: 6001,
    forceTLS: false,
    disableStats: true,
}).private('task-emmiter' + mainUser.id)
    .listen('MessageManager', (e) => {
        console.log(e.message);
    });

getting realtime directs using mgp-instagram private api

we have a simple sample code as realtime client in mgp-instagram private api into examples directory which named realtimeClient.php

after running this file from command line that wait receiving on some rtc commands such as

live-started, thread-created and after that when i get new thread from anyone or when our threads updated with new messages, i don’t get any result and output in terminal

can anybody help me how can i get this actions? receiving new messages or updating threads

<?php
set_time_limit(0);
date_default_timezone_set('UTC');

require __DIR__.'/../vendor/autoload.php';

/////// CONFIG ///////
$username = 'xxxxxx';
$password = 'xxxxxx';
$debug = true;
$truncatedDebug = false;
//////////////////////

$ig = new InstagramAPIInstagram($debug, $truncatedDebug);

try {
    $ig->login($username, $password);
} catch (Exception $e) {
    echo 'Something went wrong: '.$e->getMessage()."n";
    exit(0);
}

$loop = ReactEventLoopFactory::create();
if ($debug) {
    $logger = new MonologLogger('rtc');
    $logger->pushHandler(new MonologHandlerStreamHandler('php://stdout', MonologLogger::INFO));
} else {
    $logger = null;
}
$rtc = new InstagramAPIRealtime($ig, $loop, $logger);
$rtc->on('live-started', function (InstagramAPIRealtimePayloadLiveBroadcast $live) {
    printf('[RTC] Live broadcast %s has been started%s', $live->getBroadcastId(), PHP_EOL);
});
$rtc->on('live-stopped', function (InstagramAPIRealtimePayloadLiveBroadcast $live) {
    printf('[RTC] Live broadcast %s has been stopped%s', $live->getBroadcastId(), PHP_EOL);
});
$rtc->on('direct-story-created', function (InstagramAPIResponseModelDirectThread $thread) {
    printf('[RTC] Story %s has been created%s', $thread->getThreadId(), PHP_EOL);
});
$rtc->on('direct-story-updated', function ($threadId, $threadItemId, InstagramAPIResponseModelDirectThreadItem $threadItem) {
    printf('[RTC] Item %s has been created in story %s%s', $threadItemId, $threadId, PHP_EOL);
});
$rtc->on('direct-story-screenshot', function ($threadId, InstagramAPIRealtimePayloadStoryScreenshot $screenshot) {
    printf('[RTC] %s has taken screenshot of story %s%s', $screenshot->getActionUserDict()->getUsername(), $threadId, PHP_EOL);
});
$rtc->on('direct-story-action', function ($threadId, InstagramAPIResponseModelActionBadge $storyAction) {
    printf('[RTC] Story in thread %s has badge %s now%s', $threadId, $storyAction->getActionType(), PHP_EOL);
});
$rtc->on('thread-created', function ($threadId, InstagramAPIResponseModelDirectThread $thread) {
    printf('[RTC] Thread %s has been created%s', $threadId, PHP_EOL);
});
$rtc->on('thread-updated', function ($threadId, InstagramAPIResponseModelDirectThread $thread) {
    printf('[RTC] Thread %s has been updated%s', $threadId, PHP_EOL);
});
$rtc->on('thread-notify', function ($threadId, $threadItemId, InstagramAPIRealtimePayloadThreadAction $notify) {
    printf('[RTC] Thread %s has notification from %s%s', $threadId, $notify->getUserId(), PHP_EOL);
});
$rtc->on('thread-seen', function ($threadId, $userId, InstagramAPIResponseModelDirectThreadLastSeenAt $seenAt) {
    printf('[RTC] Thread %s has been checked by %s%s', $threadId, $userId, PHP_EOL);
});
$rtc->on('thread-activity', function ($threadId, InstagramAPIRealtimePayloadThreadActivity $activity) {
    printf('[RTC] Thread %s has some activity made by %s%s', $threadId, $activity->getSenderId(), PHP_EOL);
});
$rtc->on('thread-item-created', function ($threadId, $threadItemId, InstagramAPIResponseModelDirectThreadItem $threadItem) {
    printf('[RTC] Item %s has been created in thread %s%s', $threadItemId, $threadId, PHP_EOL);
});
$rtc->on('thread-item-updated', function ($threadId, $threadItemId, InstagramAPIResponseModelDirectThreadItem $threadItem) {
    printf('[RTC] Item %s has been updated in thread %s%s', $threadItemId, $threadId, PHP_EOL);
});
$rtc->on('thread-item-removed', function ($threadId, $threadItemId) {
    printf('[RTC] Item %s has been removed from thread %s%s', $threadItemId, $threadId, PHP_EOL);
});

//...

$rtc->start();

$loop->run();

Twig – Different Variables/Functions for one twig.html

Since 3 weeks i try to learn php with the symfony framework.
I want to build an application with which i can track my expanses.

I made good progress but since 2 days i have a little logic problem so maybe someone can help me here.

I want to make a dashboard.(the main side of the project) There the user can monitor the expenditures.
This works. Now i want also a form at the dashboard, so the user can add new expenditures. I already implement a form but with a extra route. So in my ExpenditureController i have the functions dashboard and the function addExpenditure which generate different twig.html templates.

So the user can monitor his expenditures with …budgetapp/expenditure/dashboard
and he can add new Expenditure with …budgetapp/expenditure/addexpenditure

My Dashboard-Function

    #[Route('/dashboard/', name: 'dashboard')]
public function dashboard(ExpenditureRepository $ar)
   {
    $user = $this->getUser();
    $expenditures = $ar-> findexpendituresOfUser($user);

    return $this->render('expenditure/dashboard.html.twig', [
    'expenditures' => $expenditures,
       ]);
}

The expenditure/dashboard.html.twig shows the Expentiures of the current user in a table

My addExpenditure-Function
public function addExpenditure (ManagerRegistry $doctrine, Request $request){

    $em = $doctrine->getManager();
    $expenditure = new Expenditure();
    $form = $this->createForm(ExpenditureType::class, $Expenditure);
    $form->handleRequest($request);

    if($form->isSubmitted()){
    $em->persist($expenditure);
    $em->flush();
    }

    return $this->render('expenditure/addexpenditure.html.twig', [
        'addexpenditureForm' => $form->createView()
    ]);
}

The expenditure/addexpenditure.html.twig looks like this:

{% block body %}
<div class="container">
{{form(eintragenForm)}}
</div>
{% endblock %}

My problem /mistake in thinking:
How can i implement the form to the dashboard? So of course i can take the code from the addexpenditure function and put it 1:1 in the dashboard-funciton. but i dont think this is the right way? I also tried to including template fragments with the offical Embedding Controllers Documentation of Symfony, but this also dont work.
So someone can help me with a suggestion how you would handle this in your project?

Best regards
Markus

how to convert this block of code into a php version

  <script>

// Javascript program to check if all array elements are
// same or not.

function areSame(arr)
{
    // Put all array elements in a HashSet
    let s = new Set(arr);

    // If all elements are same, size of
    // HashSet should be 1. As HashSet contains only distinct values.
    return (s.size == 1);
}
 
// Driver code
let arr=[1, 2, 3, 2];
if (areSame(arr))
        document.write("All Elements are Same");
    else
        document.write("Not all Elements are Same");

// This code is contributed by patel2127

Sort WooCommerce Products By Meta Key As Default Option

I’m trying to sort my WooCommerce Shop Page/homepage by a custom field (like_amount) in descending order. “Like_amount” contains the number of likes a product has, but some products do not have likes.

The current code I have works when I visit https://example.com/?orderby=like_amount, or select the “Sort by Likes” option I created. However, it does not work when I visit the homepage (which is also the Shop page) or any product archive/product category pages.
My suspicion is that it has something to do with the meta_key being empty for some posts.

So, any idea 1) why it isn’t working and 2) how I can ensure posts are displayed even if the meta_key is empty? Thanks in advance!

add_filter( 'woocommerce_get_catalog_ordering_args', 'ya_custom_product_sorting' );
function ya_custom_product_sorting( $args ) {
    if( isset( $_GET['orderby'] ) && 'like_amount' === $_GET['orderby'] ) {
        $args['meta_key'] = 'like_amount';
        $args['orderby'] = array( 'meta_value_num' => 'DESC' );
    }
    return $args;
}

Laravel Voyager Undefined property in Models while creating an entry

I have a model named Orders which belongsTo a Payment Method. The relationship is mentioned like this

public function payment_method() {
    return $this->belongsTo(PaymentMethod::class, 'payment_method');
}

I am using Laravel Voyager for Admin UI. I have created a relationship between the two in voyager. When I access orders, view orders, update orders, delete orders work fine. But when I create an order I get the following error

Undefined property: AppModelsOrder::$payment_method (View: /opt/bitnami/projects/project/vendor/tcg/voyager/resources/views/formfields/relationship.blade.php

I think this is because of a custom foreign key ‘payment_method’ but this is only causing problems with voyager and I don’t know why and how to resolve this. It works fine through artisan and API’s

Regex to replace USD prices in string

I have a string like this

En babyalarm kan koste alt fra $30 til $20.99, afhængigt af de funktioner, du ønsker. De fleste skærme kommer med et grundlæggende sæt funktioner, koster $3,000.

I need to replace the prices with a calculation.

I have this code, but it only gets the prices not including . and ,

$pattern = '#$(d*)#';

$string_with_price_replaced = preg_replace_callback($pattern, function($match) {
    return (string)(number_format($match[1]*6.5, 0, "", ""));
}, $string);

echo $string_with_price_replaced;

sql queries migrating to PHP7

I am now rewriting the old PHP5 scripts into PHP7, and I can’t figure out how to make the lookup of the words in the Database work. So I have two files db.php and dic_s.php

db.php
What I did here is just substituted mysql_ to mysqli_ and added a second paremeter $conn

<?php
  class db {

    function __construct()
    {
        global $dbh;
        if (!is_null($dbh)) return;
        $conn = mysqli_connect('localhost', 'user', 'password');
        mysqli_select_db($conn, 'dbname');
        mysqli_query($conn, 'SET NAMES utf8');
    }

    function select_list($query)
    {
        $q = mysqli_query($query);
        if (!$q) return null;
        $ret = array();
        while ($row = mysqli_fetch_assoc($q)) {
            array_push($ret, $row);
        }
        mysqli_free_result($q);
        return $ret;
    }
  }
?>

dic_s.php

//getting date thru $_POST
if (isset($_POST['search'])) {
// connection to database
  include('db.php');
   $db = new db();
     // filtering
       $word = trim(mysqli_real_escape_string($_POST['search']));

 // sql query
    $sql = "SELECT * FROM dictionary WHERE `word` LIKE '$word' GROUP BY `id` ORDER BY `word`";
  
     $row = $db->select_list($sql); 
      
    if(count($row)) {
        $end_result = ''; 
        foreach($row as $r) {
            
           $end_result     .= '<font color="lightblue" size="3" face="Arial">'.$r['word'] .
            '</font><i>('.$r['forms'] .')</i>';
      
           $end_result     .= '<br>Also:<i><font color="white" size="2" face="Arial"> '.$r['alterword'].'</i></font>';
           $end_result     .= '<br><ol><font color="#89F0F5" face="Arial" size="4"> '.$r['meaning'] .' </font>';
          }  echo $end_result;
} else {
        echo 'Nothing found.';
    }
}

I get these results while trying to execute the code

Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, object given in /dic_s.php on line 28

Warning: mysqli_query() expects at least 2 parameters, 1 given in /db.php on line 15

Nothing found.

For example, when I try to comply with errors and try to add the missing, it still won’t work

$q = mysqli_query($conn, $query);

Notice: Undefined variable: conn in /db.php on line 15

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /db.php on line 15

connecting project to mysql databse

Hello I’m using PHPSTORM and trying to connect my db to the project I am using this code

    <?php

$host= "localhost";
$username= "root";
$password = "";
$db_name = "test11";

$conn = mysqli_connect($host, $username, $password, $db_name);

if (!$conn) {
  echo "Connection failed!";
}
?>

It returns

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in C:Usersali_zPhpstormProjectsTectlyXsignup.php:8 Stack trace: #0 {main} thrown in C:Usersali_zPhpstormProjectsTectlyXsignup.php on line 8

How to create a php extension function with a return type-hint plus annotation

I’m trying to fix some php 8.1 deprecation notices in a PHP extension, which I believe involves either adding return type-hints (where possible, whilst maintaining some backwards-compatibility to php7.0), or adding a #[ReturnTypeWillChange] annotation where the complained-about types (e.g mixed) are not available in prior versions:

Deprecated: Return type of GoogleProtobufInternalMapFieldIter::rewind() should either be compatible with Iterator::rewind(): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0

I’ve read the relevant sections on the php internals book, and also php-src/Zend/zend_API.h to try to find a macro that will suit my purpose, but I don’t see anything about return type-hints.

/**
 * MapFieldIter::rewind()
 *
 * Implements the Iterator interface. Sets the iterator to the first element.
 */
PHP_METHOD(MapFieldIter, rewind) {
  MapFieldIter *intern = (MapFieldIter*)Z_OBJ_P(getThis());
  MapField *map_field = (MapField*)Z_OBJ_P(&intern->map_field);
  intern->position = UPB_MAP_BEGIN;
  upb_mapiter_next(map_field->map, &intern->position);
}

static zend_function_entry map_field_iter_methods[] = {
  PHP_ME(MapFieldIter, rewind,      arginfo_void, ZEND_ACC_PUBLIC)
  /* snip */
  ZEND_FE_END
};

Please figure out what the problem is in my sql command? [closed]

CREATE TABLE Track (
  track_id INTEGER NOT NULL AUTO_INCREMENT KEY,
    title VARCHAR(255),
    len INTEGER,
    rating INTEGER,
    count INTEGER,
    album_id INTEGER,
    genre_id INTEGER,
    
    INDEX USING BTREE (title),
    
    CONSTRAINT FOREIGN key(album_id) REFERENCES Album(albumb_id)
    ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT FOREIGN KEY (genre_id)REFERENCES Genre(genre_id)
    ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE = InnoDB ;