Error installing Laravel 5.1 on DigitalOcean Droplet - digital-ocean

I've the basic droplet from DigitalOcean.
First I installed composer as follows:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
and then I tried to install Laravel as follows:
composer create-project laravel/laravel --prefer-dist
Then I got the following Error:
Installing laravel/laravel (v5.1.4)
- Installing laravel/laravel (v5.1.4)
Loading from cache
Created project in /var/www/html/laravel
> php -r "copy('.env.example', '.env');"
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing vlucas/phpdotenv (v1.1.1)
Loading from cache
The following exception is caused by a lack of memory and not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details
PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:974
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 974, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(974): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(784): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(745): Symfony\Component\Console\Application->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(675): Symfony\Component\Console\Application->getTerminalWidth()
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 974
Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:974
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 974, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(974): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(784): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(745): Symfony\Component\Console\Application->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(675): Symfony\Component\Console\Application->getTerminalWidth()
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 974
How can I solve this problem? Tired of searching for different solutions online and didnt work anything.

It's because of a lack of memory. You need to set up a swap file so that composer can do it's thing:
sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
mkswap /swapfile
swapon /swapfile

Related

What is the a way to find "illegal characters found in URL"?

I have remote linux server and I am trying to build jenkins image from Dockerfile.
As I mounting local folder to the image, jenkins is not able to install necessary plugins.
I follow the advices from Official Jenkins Image: Installing more tools.
During building process I get an error:
=> ERROR [3/3] RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt------> [3/3] RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt:
#0 0.292 WARN: plugins.sh is deprecated, please switch to install-plugins.sh
#0 0.293 Analyzing war: /usr/share/jenkins/jenkins.war
#0 0.451 Downloading cloudbees-folder:6.9
#0 0.460 **curl: (3) Illegal characters found in URL**
Dockerfile:3
1 | FROM jenkins:2.60.3
2 | COPY plugins.txt /usr/share/jenkins/plugins.txt
3 | >>> RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt*
here is my content of plugins.txt file:
cloudbees-folder:6.9
antisamy-markup-formatter:2.7
build-timeout:1.28
credentials-binding:1.27.1
timestamper:1.21
ws-cleanup:0.44
ant:1.13
gradle:2.2
workflow-aggregator:2.7
github-branch-source:2.11.5
pipeline-github-lib:36.v4c01db_ca_ed16
pipeline-stage-view:2.31
git:5.0.0
subversion:2.17.0
ssh-slaves:2.854.v7fd446b_337c9
matrix-auth:3.1.6
pam-auth:1.10
ldap:659.v8ca_b_a_fe79fa_d
email-ext:2.93
mailer:1.34.2
I found one possible solution saying that Docker Jenkins Image - curl: (3) Illegal characters found in URL
there is different line endings between Windows and Mac OS.
however it did not help me. I would wait for your suggestions.

Getting error on running test validator for solana

On running command solana-test-validator on windows system, getting an error
[2022-01-06T06:54:41.602352800Z INFO solana_test_validator] solana-validator 1.9.0 (src:7782d34b; feat:378846963)
[2022-01-06T06:54:41.602479300Z INFO solana_test_validator] Starting validator with: ArgsOs {
inner: [
"solana-test-validator",
],
}
[2022-01-06T06:54:41.602617400Z WARN solana_perf] CUDA is disabled
[2022-01-06T06:54:41.602720300Z INFO solana_perf] AVX detected
[2022-01-06T06:54:41.602823600Z INFO solana_perf] AVX2 detected
[2022-01-06T06:54:41.606436300Z INFO solana_faucet::faucet] Faucet started. Listening on: 0.0.0.0:9900
[2022-01-06T06:54:41.606635600Z INFO solana_faucet::faucet] Faucet account address: 2P4mpwfirxqrL3naJD7C5UHYynPgVugaRu9sBT6m73EZ
Ledger location: test-ledger
Log: test-ledger\validator.log
⠁
⠉ Initializing...
[2022-01-06T06:54:44.975790700Z INFO solana_ledger::blockstore] "test-ledger\\rocksdb" open took 3.3s
[2022-01-06T06:54:44.981740300Z INFO solana_metrics::metrics] metrics disabled: SOLANA_METRICS_CONFIG: environment variable not found
[2022-01-06T06:54:44.982273700Z INFO solana_metrics::metrics] datapoint: shred_insert_is_full total_time_ms=0i slot=0i ⠒ Initializing...
[2022-01-06T06:54:45.595853800Z ERROR solana_ledger::blockstore] tar stdout:
[2022-01-06T06:54:45.596099200Z ERROR solana_ledger::blockstore] tar stderr: tar: Can't launch external program: bzip2
Error: failed to start validator: Failed to create ledger at test-ledger: blockstore error```
This is a current annoyance with natively using Windows with solana-test-validator. It shells out to tar with bzip2, which isn't available in the default Windows shell.
As a workaround, try installing Git BASH and then running solana-test-validator from a Git BASH shell.
Source code for the issue can be found at: https://github.com/solana-labs/solana/blob/f1e2598baa80a0ad4e8450c8b5e3c5ab164f501c/ledger/src/blockstore.rs#L3789-L3814 -- the j flag indicates to use bzip2

"phpspreadsheet" Root composer.json requires PHP extension ext-gd * but it is missing

I'm running a Laravel Application and added Laravel Excel, which requires phpoffice/phpspreadsheet.
Since both dependencies are added to my composer.json...,
"maatwebsite/excel": "^3.1",
"phpoffice/phpspreadsheet": "^1.18",
I run into the following build issue:
> [vendor 3/4] RUN composer install --no-scripts:
#14 0.883 Installing dependencies from lock file (including require-dev)
#14 0.902 Verifying lock file contents can be installed on current platform.
#14 0.934 Your lock file does not contain a compatible set of packages. Please run composer update.
#14 0.934
#14 0.934 Problem 1
#14 0.934 - Root composer.json requires PHP extension ext-gd * but it is missing from your system. Install or enable PHP's gd extension.
#14 0.934 Problem 2
#14 0.934 - phpoffice/phpspreadsheet is locked to version 1.18.0 and an update of this package was not requested.
#14 0.934 - phpoffice/phpspreadsheet 1.18.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
#14 0.934 Problem 3
#14 0.934 - phpoffice/phpspreadsheet 1.18.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
#14 0.934 - maatwebsite/excel 3.1.33 requires phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0].
#14 0.934 - maatwebsite/excel is locked to version 3.1.33 and an update of this package was not requested.
#14 0.934
#14 0.934 To enable extensions, verify that they are enabled in your .ini files:
#14 0.934 - /usr/local/etc/php/php-cli.ini
#14 0.934 - /usr/local/etc/php/conf.d/docker-php-ext-bz2.ini
#14 0.934 - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
#14 0.934 - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
#14 0.934 You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
------
executor failed running [/bin/sh -c composer install --no-scripts]: exit code: 2
My Dockerfile:
# PHP Dependencies
FROM composer:2.1.6 as vendor
COPY . /app
RUN composer install \
--no-scripts
RUN composer dump-autoload
# Frontend
FROM node:16.7 as frontend
COPY . /app
WORKDIR /app
RUN npm install && npm run dev && rm -rf node_modules
RUN ls -R -lsah /app
# Application
FROM php:7.4.21-apache
# Install system dependencies
RUN apt-get update && apt-get install \
git \
curl \
libpng-dev \
libxml2-dev \
zip \
unzip -y
RUN docker-php-ext-install pdo_mysql gd
RUN a2enmod rewrite
COPY --chown=www-data:www-data . /var/www/html
COPY --chown=www-data:www-data --from=vendor /app/vendor/ /var/www/html/vendor/
COPY --chown=www-data:www-data --from=frontend /app/public/js/ /var/www/html/public/js/
COPY --chown=www-data:www-data --from=frontend /app/public/css/ /var/www/html/public/css/
COPY --chown=www-data:www-data --from=frontend /app/public/mix-manifest.json /var/www/html/public/mix-manifest.json
RUN php artisan optimize:clear
I'm not sure where I shall continue. When I build the container without COPY --chown=www-data:www-data --from=vendor, I can get some php information:
ext-gd is installed:
root#303d9b2b0694:/var/www/html# php -ini | grep gd
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
gd
This also looks fine, doesn't it?
root#303d9b2b0694:/var/www/html# php --ini
Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration File: (none)
Scan for additional .ini files in: /usr/local/etc/php/conf.d
Additional .ini files parsed: /usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
my require composer:
"require": {
"php": "^7.4|^8.0",
"ext-gd": "*",
"ext-json": "*",
"doctrine/dbal": "^3.1.1",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.3.0",
"jenssegers/agent": "^2.6",
"laravel/framework": "^8.12",
"laravel/jetstream": "^2.3.11",
"laravel/sanctum": "^v2.11.2",
"laravel/tinker": "^v2.6.1",
"league/oauth2-client": "^2.6",
"livewire/livewire": "^v2.5.1",
"maatwebsite/excel": "^3.1",
"microsoft/microsoft-graph": "^1.34.0",
"motze92/office365-mail": "^2.0.7",
"phpoffice/phpspreadsheet": "^1.18",
"predis/predis": "^1.1"
},
last but not least, the modules:
root#303d9b2b0694:/var/www/html# php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
Edited
My php.info shortcut in regard to the PHP extension ext-gd:
gd
GD Support => enabled
GD Version => bundled (2.1.0 compatible)
GIF Read Support => enabled
GIF Create Support => enabled
PNG Support => enabled
libPNG Version => 1.6.36
WBMP Support => enabled
XBM Support => enabled
BMP Support => enabled
TGA Read Support => enabled
Edited 2
The reason for this seams to be in the FROM composer:2.1.6 as vendor stage. I thought the error came from the FROM php:7.4.21-apache stage which took me lots of time in playing around with modules and libraries.
I'll now install GD on the composer stage and see if that solves the problem
I greatly appreciate any hint or advise!
Many Thanks!
I finally solved this. The reason is very simple. In the first stage, where composer is Installing dependencies from lock file where no PHP extension ext-gd installed.
So I've added the extension to the FROM composer:2.1.6 as vendor stage:
# PHP Dependencies
FROM composer:2.1.6 as vendor
RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
docker-php-ext-install -j$(nproc) gd && \
apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev
COPY . /app
RUN composer install \
--no-scripts
RUN composer dump-autoload
Hopefully this may help others in the community as well.

Script cache:clear returned with error code 255 Fatal error: Uncaught Error: Class 'Doctrine\Bundle\DoctrineCacheBundle\DoctrineC

I have a Symfony project that works very well locally but when I put it on the server and I make the command composer install --prefer-dist --no-interaction --no-dev --optimize-autoloader I have every time this error
[c1131570c#web44 falah]$ rm -rf vendor && composer install --prefer-dist --no-interaction --no-dev --optimize-autoloader
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 78 installs, 0 updates, 0 removals
- Installing symfony/flex (v1.4.5): Loading from cache
- Installing doctrine/cache (v1.8.0): Loading from cache
- Installing doctrine/collections (v1.6.2): Loading from cache
- Installing doctrine/event-manager (v1.0.0): Loading from cache
- Installing doctrine/lexer (1.1.0): Loading from cache
- Installing doctrine/annotations (v1.7.0): Loading from cache
- Installing doctrine/reflection (v1.0.0): Loading from cache
- Installing egulias/email-validator (2.1.10): Loading from cache
- Installing symfony/polyfill-mbstring (v1.12.0): Loading from cache
- Installing twig/twig (v2.11.3): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing psr/cache (1.0.1): Loading from cache
Script cache:clear returned with error code 255
!!
!! Fatal error: Uncaught Error: Class 'Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle' not found in /home/c1131570c/public_html/falah/src/Kernel.php:23
!! Stack trace:
!! #0 /home/c1131570c/public_html/falah/vendor/symfony/http-kernel/Kernel.php(424): App\Kernel->registerBundles()
!! #1 /home/c1131570c/public_html/falah/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 /home/c1131570c/public_html/falah/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 /home/c1131570c/public_html/falah/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #4 /home/c1131570c/public_html/falah/bin/console(42): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
!! #5 {main}
!! thrown in /home/c1131570c/public_html/falah/src/Kernel.php on line 23
!!
Script #auto-scripts was called via post-install-cmd
I try to put on a server with php 7.3

GDB complaining about missing raise.c

I'm getting an an annoying error every time gdb catches an exception.
I've run the following example program
#include <stdexcept>
int main() {
throw std::invalid_argument("");
return 0;
}
And the result from running gdb is
terminate called after throwing an instance of 'std::invalid_argument'
what():
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig#entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
It's not all that bad, as I do get the information I need, it's just bugging me...
Do anyone know how to fix this?
To do full source code debugging of the C library on Ubuntu, there are just a few steps to take:
Install the debuginfo version of libc6.
It's probably already installed - the gdb package on Ubuntu has a dependency on it - but in case it isn't, run sudo apt install libc6-dbg.
Prepare the package system to download and process source code packages, if this hasn't previously been done.
sudo apt install dpkg-dev
grep deb-src /etc/apt/sources.list
Grep's output should show (and there may be additional matches that we don't need to worry about):
deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
If the grep shows that these deb-src lines are commented out with #:
# deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
then edit /etc/apt/sources.list to remove the # at the beginning of these lines and then run sudo apt update .
Download the source code corresponding to the installed version of the C library.
First, create a directory anywhere - I'll use /opt/src here.
Then do the following:
cd /opt/src
apt source libc6
If the apt command gives an error message like
E: You must put some 'source' URIs in your sources.list
then my instructions in step 2 may have become outdated; post a comment here.
When the download is complete, run this:
find $PWD -maxdepth 1 -type d -name 'glibc*'
Remember this name - it'll be something like /opt/src/glibc-2.23
Determine where gdb expects to find the source code and make appropriate adjustments.
Run gdb, have it run your program until it stops, and at the gdb prompt do this:
(gdb) info source
Current source file is ../sysdeps/unix/sysv/linux/raise.c
Compilation directory is /build/glibc-KM3i_a/glibc-2.23/signal
So gdb is expecting the source code to be in /build/glibc-KM3i_a/glibc-2.23 . There are two ways to fix this:
Move (or use a symlink) so that the source code is (or appears to be) in /build/glibc-KM3i_a/glibc-2.23 .
or
Tell gdb how to substitute the correct source directory pathname:
(gdb) set substitute-path /build/glibc-KM3i_a/glibc-2.23 /opt/src/glibc-2.23
Now, go back to your frame, and gdb should show the source code line:
(gdb) frame 1
#1 0xb7e2fea9 in __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:54
return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);