Laravel mcrypt timeout - php

apache,php 5.5.27,laravel 4.2 ,ubuntu15.04
My code works well on windows. But it failed on linux.
error code:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
HELP
Maximum execution time of 1000 seconds exceeded
in /home/project/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php line 55
$iv = mcrypt_create_iv($this->getIvSize(), $this->getRandomizer());
I have changed the max_execution_time to 1000 but it still does not work.
Can anyone help?

Related

High resolution image upload fails stream_copy_to_stream(): read of 8192 bytes

I am using laravel + twill inside docker containers with php7.4.3-fpm + nginx. Everything works fine appart from when I am trying to upload images of high resolution. If I upload image of 3000x3000px there are no problem as soon as I try to do the same with higher resolution (4500x4500px) I get the following error,
message: "stream_copy_to_stream(): read of 8192 bytes failed with errno=21 Is a directory"
exception: "ErrorException"
file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php"
line: 159
trace: [{function: "handleError", class: "Illuminate\Foundation\Bootstrap\HandleExceptions", type: "->"},…]
0: {function: "handleError", class: "Illuminate\Foundation\Bootstrap\HandleExceptions", type: "->"}
function: "handleError"
class: "Illuminate\Foundation\Bootstrap\HandleExceptions"
type: "->"
1: {file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php", line: 159,…}
file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php"
line: 159
function: "stream_copy_to_stream"
Is it a php-fpm configuration issue? Is it problem with php? Has anyone had similar problems?
These steps solved the same issue for me!
Open file /etc/php/7.*/fpm/php.ini
Edit upload_max_filesize
Edit post_max_size
reload php7.*-fpm service
good luck!
I did find a solution, my problem was with php.ini setting, how lame of me to overlook it.
I fixed it by adding these to the docker entry file.
sed -i -e "s/upload_max_filesize = 2M/upload_max_filesize = 64M/g" $PHP_INI_DIR/php.ini
sed -i -e "s/post_max_size = 8M/post_max_size = 64M/g" $PHP_INI_DIR/php.ini
sed -i -e "s/memory_limit = 128M/memory_limit = 256M/g" $PHP_INI_DIR/php.ini

SOLVED: Compiling PHP with GD : relocation R_X86_64_PC32 against symbol `WebPMemoryWrite' can not be used when making a shared object;

I'm currently installing PHP with GD library from sources on a RedHat7 server and I'm facing some issues.
I configure PHP with this command:
./configure --with-apxs2=/server/lib/httpd/bin/apxs --with-pdo-mysql --with-config-file-path=/server/php-7.3.9/conf --with-libxml-dir=/server/lib/libxml2 --with-curl=/server/lib/curl --with-gd --enable-mbstring --with-jpeg-dir=/server/lib/libjpeg --with-png-dir=/server/lib/libpng –with-webp-dir=/server/lib/webp
It works but when I'm doing the make command I have this error:
/bin/ld: /server/lib/webp/lib/libwebp.a(picture_enc.o): relocation R_X86_64_PC32 against symbol `WebPMemoryWrite' can not be used when making a shared object; recompile with -fPIC
/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [libphp7.la] Error 1
I also tried to compile and install it without webp (It's not required in the PHP documentation: php doc) but I have this error :
ext/gd/libgd/.libs/gd_webp.o: In function `gdImageCreateFromWebpCtx':
/server/php-7.3.9/ext/gd/libgd/gd_webp.c:68: undefined reference to `WebPGetInfo'
/sever/php-7.3.9/ext/gd/libgd/gd_webp.c:79: undefined reference to `WebPDecodeARGB'
ext/gd/libgd/.libs/gd_webp.o: In function `gdImageWebpCtx':
/server/php-7.3.9/ext/gd/libgd/gd_webp.c:153: undefined reference to `WebPEncodeRGBA'
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
So it seems to be required.
Can you please help me to solve this
Thanks
I resolved my issue by replacing my installation of webp package.
At first I used the pre-compiled linux package and replacing it by native sources and a compiling, make & make install solve the problem.
Thanks all

Error while sending QUERY packet. Magento 2 (2.1.5)

I'm trying to install the Magento 2 (2.1.5) on web server with CLI. but its is giving error
[Exception]
Warning: Error while sending QUERY packet. PID=34 in
/home/cocaine/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php
on line 228
I searched for the solution and all the solution is that increase the
max_allowed_packet
First max_allowed_packet was 33MB but now i increased it to 512MB. But it's still giving me same error with different PID.
CLI commands used to install Magento is
magento setup:install --base-url=http://www.example.com \
--db-host=localhost --db-name=db_name --db-user=db_admin --db-password=db_admin_password \
--admin-firstname=User --admin-lastname=Magento --admin-email=admin#demo.com \
--admin-user=admin_site --admin-password=admin_password --language=en_US \
--currency=INR --timezone=Asia/Kolkata --cleanup-database \
--session-save=db --use-rewrites=1
You need to increase wait_timeout and max_allowed_packet value from your database configuration.
increase wait_timeout = XX to wait_timeout=180
Also, Change at least max_allowed_packet = 512M

Symfony \ Component \ Debug \ Exception \ FatalErrorException Call to undefined method Illuminate\Database\MySqlConnection::setReconnector()

I am creating laravel 4 login system using "Sentry by Cartalyst". Everything is running well in my localhost,
But, when I upload to my shared hosting. I got some following error.
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Call to undefined method Illuminate\Database\MySqlConnection::setReconnector()
I see an error in bootsrtap/compiled.php
$app = $this->app;
$connection->setCacheManager(function () use($app) {
return $app['cache'];
});
$connection->setPaginator(function () use($app) {
return $app['paginator'];
});
$connection->setReconnector(function ($connection) {
$this->reconnect($connection->getName());
});
Please help me to fix this eror.
Try making sure that composer has installed AND updated the vendor specific files on your shared hosting: run 'composer install' & 'composer update'

Enable PCNTL in Ubuntu PHP - test fails

I need help on How to: Enable PCNTL in Ubuntu PHP.
$ mkdir /tmp/phpsource
$ cd /tmp/phpsource
$ wget http://museum.php.net/php5/php-5.3.2.tar.gz
$ tar xvf php-5.3.2.tar.gz
$ cd php-5.3.2/ext/pcntl
$ phpize -bash: phpize: command not found
Everything went fine until I tried to run phpize! And then I get the error '-bash: phpize: command not found' ?? Any ideas?
UPDATE ran:
$ sudo apt-get update
and then ran:
$ sudo apt-get install php5-dev
With the help of Nick I managed to finish the procedure. But 'make test' fails???
$ phpize
$ ./configure
$ make
$ cp modules/pcntl.so /usr/lib/php5/20090626/
$ echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini
$ make test - FAILED!
HELP: I typed 'echo "extension=pcntl.so > /etc/php5/conf.d/pcntl.ini' instead of 'echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini' the first time I ran this. Is that BAD?
--------------------------------- Make TEst Error Messages --------------------------------------
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1850 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1852 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1850 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1852 in Unknown on line 0
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0
Warning: Module 'pcntl' already loaded in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1850 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1852 in Unknown on line 0
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0
Warning: Module 'pcntl' already loaded in Unknown on line 0
=====================================================================
PHP : /usr/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.3.2-1ubuntu4.18
ZEND_VERSION: 2.3.0
PHP_OS : Linux - Linux lvps217-8-253-63.vps.webfusion.co.uk 2.6.32-042stab068.8 #1 SMP Fri Dec 7 17:06:14 MSK 2012 x86_64
INI actual : /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini
More .INIs :
CWD : /tmp/phpsource/php-5.3.2/ext/pcntl
Extra dirs :
VALGRIND : Not used
=====================================================================
TIME START 2013-01-02 23:05:56
=====================================================================
FAIL Test pcntl wait functionality [tests/001.phpt]
FAIL pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait() [tests/002.phpt]
FAIL pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK [tests/003.phpt]
FAIL Bug #47566 (return value of pcntl_wexitstatus()) [tests/bug47566.phpt]
FAIL pcntl_alarm() [tests/pcntl_alarm.phpt]
FAIL pcntl_exec() [tests/pcntl_exec.phpt]
FAIL pcntl_exec() 2 [tests/pcntl_exec_2.phpt]
FAIL pcntl_exec() 3 [tests/pcntl_exec_3.phpt]
FAIL Test function pcntl_fork() by calling it with its expected arguments [tests/pcntl_fork_basic.phpt]
FAIL Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson [tests/pcntl_fork_variation.phpt]
FAIL pcntl_signal() [tests/pcntl_signal.phpt]
FAIL pcnt_signal_dispatch() [tests/pcntl_signal_dispatch.phpt]
FAIL pcntl_wait() [tests/pcntl_wait.phpt]
FAIL Closures as a signal handler [tests/signal_closure_handler.phpt]
=====================================================================
TIME END 2013-01-02 23:05:59
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 0
Exts tested : 44
---------------------------------------------------------------------
Number of tests : 14 14
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 14 (100.0%) (100.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Tests passed : 0 ( 0.0%) ( 0.0%)
---------------------------------------------------------------------
Time taken : 3 seconds
=====================================================================
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Test pcntl wait functionality [tests/001.phpt]
pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait() [tests/002.phpt]
pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK [tests/003.phpt]
Bug #47566 (return value of pcntl_wexitstatus()) [tests/bug47566.phpt]
pcntl_alarm() [tests/pcntl_alarm.phpt]
pcntl_exec() [tests/pcntl_exec.phpt]
pcntl_exec() 2 [tests/pcntl_exec_2.phpt]
pcntl_exec() 3 [tests/pcntl_exec_3.phpt]
Test function pcntl_fork() by calling it with its expected arguments [tests/pcntl_fork_basic.phpt]
Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson [tests/pcntl_fork_variation.phpt]
pcntl_signal() [tests/pcntl_signal.phpt]
pcnt_signal_dispatch() [tests/pcntl_signal_dispatch.phpt]
pcntl_wait() [tests/pcntl_wait.phpt]
Closures as a signal handler [tests/signal_closure_handler.phpt]
ANY ideas!?!
Carl
Here's what I've found in Ubuntu 12.04:
Check your PHP.ini for the pnctl functions being disabled.
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority
phpinfo reports the function is already loaded but it will not actually work without putting the pcntl.ini file into /etc/php5/conf.d.
Sadly, this causes 'module already loaded' errors every time PHP session cleanup cron in /etc/cron.d kicks off, but PCNTL won't function without both of these pieces in place, and so far I haven't found a good solution to disable the 'already loaded' error. Its messy, and ugly, and spams my root mail, and when I can find a solution, I will post it. I've only run into this problem in 12.04 so far.
UPDATE
I hacked my /usr/lib/php5/maxlifetime script file to stop spamming with pnctl errors (PHP Warning: Module 'pcntl' already loaded in Unknown on line 0). Here are my edits - I specifically added in the 'E_DEPRECATED' line to quiet the messages.
Line 8:
cur=$(php5 -c /etc/php5/${sapi}/php.ini -d "error_reporting='E_ALL & ~E_DEPRECATED'" -r 'print ini_get("session.gc_maxlifetime");' 2> /dev/null)
There is some steps like this:
(my OS is debian7.2 xfce x86).
1: i install pcntl like this
#mkdir php
#cd php
#apt-get source php5
#cd php5-5.4.4/ext/pcntl
#phpize
#./configure
#make
#echo "extension=pcntl.so" > /etc/php5/mods-available/pcntl.ini
#ln -s /etc/php5/mods-available/pcntl.ini /etc/php5/conf.d/pcntl.ini
2: when is restart nginx or apache2, the php get one warning.
"PHP Warning: Module ‘pcntl’ already loaded in Unknown on line 0"
3: so i
"rm -rf /etc/php5/mods-available/pcntl.ini and
/etc/php5/conf.d/pcntl.ini"
4: edit the "php.ini" file .
a.apache2, it's in "/etc/php5/apache2/php.ini"
b.cgi like nginx,it's in "/etc/php5/cgi/php.ini"
make the
"disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited..."
comments, add " ; " in front of "disable_functions".
restart your server and the warning gone.good luck.
On my dev machine with ubuntu 12.10 (and earlier versions too) pcntl is/was already enabled.
$ php -m | grep pcntl
pcntl
I guess thats the problem:
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0
So just don't install it again.
I NEEDED to restart the server! And now it works! Doh.. Thanks for everybodys input.
In Ubuntu 15.04, the pcntl is installed in the php CLI, but disabled by default. To enable, edit /etc/php5/cli/php.ini and comment out the line:
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
If you want these enabled in apache2, then edit the file /etc/php5/apache2/php.ini and make the same change.
It may be advisable to only remove the functions you need to use, in order to preserve as much of the security restrictions as possible.

Categories