Why doesn't the php.ini file change in laradock? - php

Installed docker, docker-compose and laradock.
Changed settings in nginx and /etc/hosts.
The site is open and the flight is normal.
I just noticed that the error display does not work. Then I found out that it was necessary to register display_errors On in php.ini.
In my .env version of php 7.2 In laradock, in the file /home/serii/Web/laradock/php-fpm/php7.2.ini, changed the display_errors setting to On.
Then I run sudo docker-compose down and rebuild for php-fpm sudo docker-compose build worker php-fpm
Then sudo service apache2 stop && sudo docker-compose up -d nginx php-fpm mysql workspace
In workspace, php.ini is in /etc/php/7.2/cli/php.ini
And there display_errors Off.
Only for some reason php.ini in phpinfo () is located in a different path, but such path does not exist in workspace.
I've been rummaging in the net for half a day and can't find a clear answer.
Thanks in advance.

Because the laravel.ini doesn't reload. you will find some configuration saved in laravel.ini you have to force recreate to reload it
docker-compose up -d --force-recreate --build php-fpm

Related

file upload error log at centos php server

I'm testing file upload between client and server.
But file upload not working because below error.
Unable to move '/tmp/phpxQHW5q' to '/var/www/html/mri_image/test.jpg' in /var/www/html/server_form.php on line 49, referer: http://192.168.1.12/client_form.php
I have searched this problem at stackoverflow.
Most solution is permision problem.
So, tmp and mri_image folder own by apache and changed mod 755.
Then, not working i want to your help
For reference, my os is CentOS 7, php version is 7.3
I had an issue recently with Apache and PHP trying to write to /tmp, but stating that the script failed with an error "No such file or directory"
Centos 7 uses systemd, which has an awesome feature (PrivateTmp) that breaks Apache/PHP access to /tmp folders (particularly in cases where the files need to be shared to other processes/seen by others. This feature works by creating a sort of "virtual" /tmp directory for each process, so a file seen by Apache wouldn't be seen by PHP, etc.
First, copy the httpd.service and php-fpm.service files from /usr/lib/systemd/system/ to /etc/systemd/system using the commands below.
cp /usr/lib/systemd/system/httpd.service /etc/systemd/system/. && cp /usr/lib/systemd/system/php-fpm.service /etc/systemd/system/.
After copying those into place, edit each copy of the files in the new location and change the line with PrivateTmp=true to PrivateTmp=false using vi, or your preferred text editor.
vi /etc/systemd/system/httpd.service
vi /etc/systemd/system/php-fpm.service
After those changes, you need to restart systemd, as well as php-fpm and apache.
Restart systemd:
sudo systemctl daemon-reload
Restart apache:
sudo systemctl restart httpd
Restart php-fpm:
sudo systemctl restart php-fpm

Why is PHP not recompiling with nginx?

PHP is not recompiling properly.
I have PHP 7.2 installed on Nginx using php-fpm on Centos 7. I am recompiling php with more options using ./configure, make clean, make, make test and make install.
Everything works well and no errors are thrown, except the updated php
compile is not being reflected on the phpinfo(); table. If you see the
"Build Date" it is not changing. The "Configure Command" is also not updating after recompiling.
Why could php not be recompiling and the "Build Date" not updating, and the "Configure Command" also not reflecting my changes?
I have restarted nginx, restarted php-fpm, and still no change. I can edit the php.ini file without problems as well and they do update, but the php itself is not updating after I recompile and add more options (--with-openssl). I even restarted the server. PHP files are served fine.
Can anybody help?
I just figured it out after about half a day.
The reason the new php recompile was not being recognized was because I needed to manually copy the new updated php-fpm program to the /usr/local/bin directory, like this:
cp sapi/fpm/php-fpm /usr/local/bin
And that fixed it. So basically php WAS being recompiled correctly, but that was not seen by the system because php-fpm was not manually copied to the directory nginx uses to pull php-fpm from. The file must be overwritten while php-fpm is turned off.
Bonus Tip
This is my command to reload php, php-fpm and nginx after recompiling:
# gracefully stop the php-fpm process
pkill -15 php-fpm
# copy the new recompiled php-fpm to the executable directory
cp -f sapi/fpm/php-fpm /usr/local/bin
# start php-fpm
/usr/local/bin/php-fpm
# signal nginx to reload
nginx -s reload
All in one line:
pkill -15 php-fpm && cp -f sapi/fpm/php-fpm /usr/local/bin && /usr/local/bin/php-fpm && nginx -s reload

Laravel 5.3 Homestead php7 reload php.ini file

I made some changes to /etc/php/7.0/cli/php.ini on my laravel homestead machine. But I can't get it to load the new settings. Tried restarting nginx, restart php7, etc...
The file /etc/php/7.0/cli/php.ini is for PHP-running trough commandline.
There should a php.ini in /etc/php/7.0/fpm with the settings for PHP-FPM. After you've edited that, restart php-fpm with this command
service php7.0-fpm restart
I'm also running Homestead but a more recent version, for me it was the following:
service php7.1-fpm restart

Changes to php.ini not reflected in PHP's phpinfo()

I just can't get php_info() values to change on my localhost setup, or the related phpMyAdmin maximum file size.
So I have located the PHP file that phpinfo states is being loaded. I have changed the three parameters:
upload_max_filesize
post_max_size
memory_limit
Saved the file, restarted Apache and MySQL, reloaded the phpinfo() page... no changes.
I've also tried putting a .htaccess file in the web root folder with changes to these parameters. This is reflected in phpinfo in the local value (the master value still says 2M for maximum upload size), and then when I go to phpMyAdmin the maximum upload size is still 2M...
I've looked for a php.ini file in C://windows as this is where phpinfo() states the master value is derived from. But there isn't any php.ini file there. So I created one with the values I wanted... no success!
How can I fix this?
I came across the same issue.
Check if php-fpm is running by this command:
ps aux | grep php-fpm
php-fpm stands for "FastCGI Process Manager" for PHP and it was probably built in your system.
If so, you have to restart it. Assuming you are on a Linux system type:
For Red Hat Linux, CentOS, Fedora, etc.
sudo systemctl restart php-fpm.service
For Debian-based systems (like Ubuntu)
sudo service php-fpm restart
or
sudo service php7.0-fpm restart
Don't do what I did... I changed max_input_vars from 1000 to 10000 but never noticed that the line was commented out by default.
; max_input_vars = 10000
I couldn't figure out why the value displayed in phpinfo() wouldn't change.
Doh!
Have you attempted to look for php.ini-development / php.ini-production? If you update php.ini-development and then remove the -development then you should be good to go I believe.
Don't do what I did though and update the php.ini-development file and forget to remove the -development... I spent far too long wondering why the settings weren't updating!
That happen for me, php.ini changes do not affect in phpinfo()
The reason is, that several php-fpm installed into the system and command was not reload config
service php-fpm restart
Proper command to reload service php74-php-fpm restart in my case:
service php74-php-fpm restart

Cannot update php.ini in Mac OS Lion

Something is very wrong in my php/apache setup in Mac OS Lion.
If I change /private/etc/php.ini then I do sudo apachectl -k restart, the changes are not reflected.
After I do sudo apachectl -k stop, I can still connect to localhost in browser, and my php runs as usual.
I've even tried emptying /private/etc/php.ini and restart the apache server, but still nothing happened.
In phpinfo, value of Loaded Configuration File is /private/etc/php.ini
Did I miss anything?
if you have MAMP then just change the php.ini file in the MAMP folder with the php version you use.
If not then, try the /etc/php.ini with a sudo vim command. You won't be able to make the changes if you don't access the ini as sudo.
That was my problem earlier when I was trying to get xdebug working, I had to edit the php as super user.

Categories