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 ;

Incorrect Scaling when converting from excel to pdf using PhpSpreadsheet

I have an excel template the I am filling with PhpSpreadsheet, which works flawlessly. However, when I try to then save it as a pdf, the scaling is wrong and the content does not fit on the page. I have tried using Tcpdf, Mpdf, and Dompdf, all with similar results. Mpdf has given the closest output so far, however the scaling is still incorrect.

I have tried setting the margins (that seems to have no effect), as well as setting FitToPage, FitToWidth and FitToHeight to true.

Any ideas on what how to fix it? Ideally, I would like to use Tcpdf, as I am using it for other purposes.

Here is the code I’m using:

// XLSX
use PhpOfficePhpSpreadsheetSpreadsheet;
use PhpOfficePhpSpreadsheetWriterXlsx;

$spreadsheet = PhpOfficePhpSpreadsheetIOFactory::load(THIS_LIB_PATH_UP.'templates/1/rent2.xlsx');
$sheet = $spreadsheet->getActiveSheet();
$sheet->getPageMargins()
    ->setLeft(0)
    ->setRight(0)
    ->setTop(0)
    ->setBottom(0)
    ->setHeader(0)
        ->setFooter(0);
$sheet->getPageSetup()->setFitToWidth(1);
$sheet->getPageSetup()->setFitToHeight(1);
$sheet->getPageSetup()->setPaperSize(PhpOfficePhpSpreadsheetWorksheetPageSetup::PAPERSIZE_A4);
$sheet->getPageSetup()->setFitToPage(true);
// Date 
$sheet->setCellValue('F4', date('d-m-Y'));
// Receipt Number 
$sheet->setCellValue('F6', 'Receipt No. '.rand(0,100));
// FROM
$sheet->setCellValue('B10', 'Owner');
$sheet->setCellValue('B11', 'The');
$sheet->setCellValue('B12', 'Address');
$sheet->setCellValue('B13', 'Mobile');
$sheet->setCellValue('B14', '[email protected]');
// TO
$sheet->setCellValue('D10', 'Tenant');
$sheet->setCellValue('D11', 'Address');
$sheet->setCellValue('D12', '[email protected]');
$sheet->setCellValue('D13', 'Mobile');
// Description / Total
$sheet->setCellValue('B20', "Rent");
$sheet->setCellValue('F20', rand(0,500));
// Payment Method 
$sheet->setCellValue('C34', 'Bank Transfer');
$writer = new Xlsx($spreadsheet);
$filename = THIS_LIB_PATH_UP.'templates/1/'.date('Y-m-d_H-i-s');
$writer->save($filename.'.xlsx');

// Open the xlsx file for pdf export
$writer = PhpOfficePhpSpreadsheetIOFactory::createWriter($spreadsheet, 'Tcpdf');
$writer->save($filename.'.pdf');
echo 'Done';```

[The excel template][1]
[Excel directly exported to PDF (Expected)][2]
[TcPDF output][3]
[DomPDF Output][4]
[Mpdf Output][5]


  [1]: https://i.stack.imgur.com/YBL8z.png
  [2]: https://i.stack.imgur.com/xVl0X.png
  [3]: https://i.stack.imgur.com/6jDIi.png
  [4]: https://i.stack.imgur.com/y1bDb.png
  [5]: https://i.stack.imgur.com/jCLPq.png

Any help would be greatly appreciated, thanks!

Error Building PHP 8 Dockerfile With OPCache Enabled

Randomly when I run my docker build i get a mail error halting CI. If I rerun the CI script in Gitlab once or twice woth no changes made to config it often successfully builds. I am at a loss as to why this is an intermittent issue and how to prevent it from happening. It appears to be an issue with the jit/zend_jit.lo dependeny in OPCache (possibly) as it only occurs when at this stage of the build.

My docker file is…

FROM php:8.0-apache

#Set The Project Work Directory
WORKDIR /var/www/html


#Copy The Application To The Web Directory
COPY . /var/www/html


# Install composer & app dependencies
COPY --from=composer:2.0.13 /usr/bin/composer /usr/local/bin/composer


# Add Apache Extensions
RUN a2enmod expires


# Install PHP extensions
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*


# Run Composer Installation
RUN composer install --prefer-dist --no-scripts


# Copy Configuration Files
COPY docker/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY docker/opcache.ini /usr/local/etc/php/conf.d/opcache.ini


# Copy Shell Execution Script
COPY docker/start.sh /usr/local/bin/start


# Change PRoject File Permissions
RUN chown -R www-data:www-data /var/www/html && chmod u+x /usr/local/bin/start && a2enmod rewrite


# Execute Shell Execution Script
CMD ["/usr/local/bin/start"]

The executing command in the Dockerfile is…

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

And the returned log in Gitlab pipeline is…

cc /usr/src/php/ext/opcache/jit/dynasm/minilua.c -lm -o minilua
make: Circular jit/zend_jit.lo <- jit/zend_jit.lo dependency dropped.
 cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/Optimizer/compact_vars.c  -fPIC -DPIC -o Optimizer/.libs/compact_vars.o
 cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/Optimizer/zend_dump.c  -fPIC -DPIC -o Optimizer/.libs/zend_dump.o
/bin/bash /usr/src/php/ext/opcache/libtool --mode=compile cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit_vm_helpers.c -o jit/zend_jit_vm_helpers.lo 
mkdir jit/.libs
 cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit_vm_helpers.c  -fPIC -DPIC -o jit/.libs/zend_jit_vm_helpers.o
./minilua /usr/src/php/ext/opcache/jit/dynasm/dynasm.lua  -D X64=1 -o jit/zend_jit_x86.c /usr/src/php/ext/opcache/jit/zend_jit_x86.dasc
/bin/bash /usr/src/php/ext/opcache/libtool --mode=compile cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit.c -o jit/zend_jit.lo 
 cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit.c  -fPIC -DPIC -o jit/.libs/zend_jit.o
cc: fatal error: Killed signal terminated program cc1
compilation terminated.
make: *** [Makefile:299: jit/zend_jit.lo] Error 1
The command '/bin/sh -c install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache' returned a non-zero code: 2
Cleaning up file based variables 00:00
ERROR: Job failed: command terminated with exit code 2

I would still like to use OCache but am trying to avoid a unpredictable error from halting CI all the time and causing a restart of the pipeline.

Not sure if it makes a difference but I am not using the shared runners hosted by Gitlab I am using my own runners hosted on my Kubernetes cluster.