I want to remove output_buffering and want to make change to memory_limit by editing etc/php.ini file
But none of my changes are taking effect.
After editing etc/php.ini file as a super user. I've restarted httpd.service using following command
sudo systemctl restart httpd.service
I am using centOS 8
[root#backend adminuser]# cat /etc/*release
CentOS Linux release 8.0.1905 (Core)
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
CentOS Linux release 8.0.1905 (Core)
CentOS Linux release 8.0.1905 (Core)
php-common packages are as below
[root#backend adminuser]# rpm -qc php-common
/etc/php-zts.d/20-bz2.ini
/etc/php-zts.d/20-calendar.ini
/etc/php-zts.d/20-ctype.ini
/etc/php-zts.d/20-curl.ini
/etc/php-zts.d/20-exif.ini
/etc/php-zts.d/20-fileinfo.ini
/etc/php-zts.d/20-ftp.ini
/etc/php-zts.d/20-gettext.ini
/etc/php-zts.d/20-iconv.ini
/etc/php-zts.d/20-phar.ini
/etc/php-zts.d/20-sockets.ini
/etc/php-zts.d/20-tokenizer.ini
/etc/php.d/20-bz2.ini
/etc/php.d/20-calendar.ini
/etc/php.d/20-ctype.ini
/etc/php.d/20-curl.ini
/etc/php.d/20-exif.ini
/etc/php.d/20-fileinfo.ini
/etc/php.d/20-ftp.ini
/etc/php.d/20-gettext.ini
/etc/php.d/20-iconv.ini
/etc/php.d/20-phar.ini
/etc/php.d/20-sockets.ini
/etc/php.d/20-tokenizer.ini
/etc/php.ini
For SSE Script I want to make output_buffer as null or Off like my another server but its not taking any change. I tested by changing php.ini as a root user and restarted httpd services.
I am assuming you are using php-fpm
Following command worked for me.
Connect via terminal and Make sure you are Super(Root) user
sudo su
Now run following command
sudo systemctl restart php-fpm.service
Note : Test by making small change like increasing or decreasing memory_limit in php config file and run above command and review change using phpinfo()
You don't mention whether you're using mod_php or php-fpm. Running sudo systemctl restart httpd.service only helps for mod_php. If you're using php-fpm, you need sudo systemctl restart php-fpm.service instead.
Changing etc/php.ini does not work any more.
You need to add your own .ini file now under "/etc/php.d" and restart php
confirm the path from phpinfo. Look for
"Scan this dir for additional .ini files /etc/php.d"
create file (30 prefix to file name is like priority or how late to load):
sudo vi /etc/php.d/30-user.ini
Add entries like:
max_execution_time=200
post_max_size=100M
upload_max_filesize=100M
Restart PHP (restarting Apache does not help)
Check the service (if not present ..restarting Apache should work: sudo systemctl restart httpd )
sudo systemctl status php-fpm
Resart the service
sudo systemctl restart php-fpm
Related
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
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
I am using https://github.com/wilmoore/php-version to switch between php versions on my local machine, installed within ~/php/versions. Currently setting up separate VMs with different versions of php installed is not an option.
When I switch php version through the command line using the linked tool, I see it listed as php 7. This also works when using php -v. I have restarted terminal and the machine and it still says php 7.
I have updated composer.json to require php 7.0.2 and greater. Yet when I use phpinfo() in my laravel application, it always states the default PHP Version 5.5.9-1ubuntu4.14.
Where is laravel pointing to the php distribution in my Ubuntu 14.04.3 machine and where can I change this path?
EDIT: I am using Apache. I can see in the phpinfo() output that it is reading the ini file from /etc/php5/apache2/php.ini. I have looked in this file but cannot see where to point to the php distribution.
first make sure that php7.*.conf and php7.*.load files are exist in /etc/apache2/mods-available directory.
then use sudo a2enmod php7.* to enable the mod
use sudo a2dismod php5.* to disable the mod
after running the two commands restart your apache2 server
using sudo systemctl restart apache2
The Apache loads the php5_module library in /etc/apache2/mods-available/php5.load.
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
If you know the loactions of your alternative libraries you can change them in this file.
After editing you need to restart your apache. sudo service apache2 restart or sudo systemctl restart apache2.service
Had the same issue on ubuntu16.
ls -l /etc/apache2/mods-available/php7* ,
showed 2 versions -
/etc/apache2/mods-available/php7.0.conf
/etc/apache2/mods-available/php7.2.conf
Deleted the /etc/apache2/mods-available/php7.0.conf, restarted apache2, and phpinfo() via apache2 showed php7.2
I configured a web server last week, it worked fine.
Today I request its homepage, I see a timezone error, as it should be configured into my php.ini file.
I try a phpinfo(); on my webserver, it gives me:
Configuration File (php.ini) Path /opt/rrh/php/lib
But no php.ini file loaded.
I investigate, the php file exists and has very large permissions:
ls -la /opt/rrh/php/lib
-rwxrwxrwx 1 apache root 68448 Nov 22 10:10 php.ini
I try a parse_ini_file("/opt/rrh/php/lib/php.ini"));, it returns no error...
Of course I restart my server a dozen of time.
What can I do more to resolve my problem?
My system:
Redhat 6
Apache 2.4
PHP 5.5.19 with libphp5.so apache module
TL;DR; If you're still having trouble after restarting apache or nginx, also try restarting the php-fpm service.
The answers here don't always satisfy the requirement to force a reload of the php.ini file. On numerous occasions I've taken these steps to be rewarded with no update, only to find the solution I need after also restarting the php-fpm service. So if restarting apache or nginx doesn't trigger a php.ini update although you know the files are updated, try restarting php-fpm as well.
To restart the service:
Note: prepend sudo if not root
Using SysV Init scripts directly:
/etc/init.d/php-fpm restart # typical
/etc/init.d/php5-fpm restart # debian-style
/etc/init.d/php7.0-fpm restart # debian-style PHP 7
Using service wrapper script
service php-fpm restart # typical
service php5-fpm restart # debian-style
service php7.0-fpm restart. # debian-style PHP 7
Using Upstart (e.g. ubuntu):
restart php7.0-fpm # typical (ubuntu is debian-based) PHP 7
restart php5-fpm # typical (ubuntu is debian-based)
restart php-fpm # uncommon
Using systemd (newer servers):
systemctl restart php-fpm.service # typical
systemctl restart php5-fpm.service # uncommon
systemctl restart php7.0-fpm.service # uncommon PHP 7
Or whatever the equivalent is on your system.
The above commands taken directly from this server fault answer
To force a reload of the php.ini you should restart apache.
Try sudo service apache2 restart from the command line.
Or sudo /etc/init.d/apache2 restart
You also can use graceful restart the apache server with service apache2 reload or apachectl -k graceful.
As the apache doc says:
The USR1 or graceful signal causes the parent process to advise the
children to exit after their current request (or to exit immediately
if they're not serving anything). The parent re-reads its
configuration files and re-opens its log files. As each child dies off
the parent replaces it with a child from the new generation of the
configuration, which begins serving new requests immediately.
sudo apachectl restart does the job in 2021 running Mac latest Big Sur OS
For Homebrew apache users it's brew services restart httpd
I installed WAMP on my local machine. My PHP version is 5.3.3 in phpinfo() but that extension doesn't exist! :(
How can I install this extension without compiling it? Here is just source of it.
The extension was there! All you need to do is clearing the comment(;) before this line in php.ini file:
Windows:
;extension=php_intl.dll
to
extension=php_intl.dll
Linux:
;extension=intl
to
extension=intl
Then restart apache2 or php-fpm if you are using it.
if you see this on Debian / other Linux platforms.
sudo apt-get install php5-intl - for PHP 5.6
sudo apt-get install php7.0-intl - PHP 7+
Amazon Linux
sudo yum install php70-intl
After that restart Apache services.
sudo service apache2 restart restart apache to get the changes.
in wamp or xampp open php.ini file and find the below line, then remove comment (;) at first of it:
;extension=php_intl.dll
if you did not find the line, add it in the php.ini file:
extension=php_intl.dll
It may be because of Apache. Restart Apache by following command
service httpd restart
and try again.
If you added extension=php_intl.dll in your php.ini and it didn't work you can copy icu****.dll files (about five of them) from PHP folder to Apache /bin folder.