Hot answers tagged

62

If you already install other version of php, you only need to change php* module used by apache. for example, I have php5 and php7.0. when I want apache use php7.0, I only need to enable his module and disalbe php5 module. sudo a2dismod php5 sudo a2enmod php7.0


54

Nginx client_max_body_size PHP post_max_size upload_max_filesize And restart or reload php fpm. Source: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size


14

Instead of changing php.ini file, I add all information in the nginx sites-available files. I see you got your answer long time ago, but this is the way I do it: In my virtualhost under server {} block, I added: client_max_body_size 128m; Then in the location ~ .php$ {} block I added: fastcgi_param PHP_VALUE "upload_max_filesize=128M \n post_max_size=...


13

I had a problem with restarting so I just killed the process and started it manually. sudo pkill php5-fpm sudo service php5-fpm start


11

I have found a few tweaks to solve my problem. First: load a separate php.ini files: A user in a arch linux forum posted this from the man php page: FILES php-cli.ini The configuration file for the CLI version of PHP. php.ini The standard configuration file will only be used when php-cli.ini cannot be found. If I creating a /etc/php/php-...


11

I found from the following link that the Systemd php-fpm service may be configured to block any write action on certain folders and subfolders, and /usr is impacted by this. You may want to move you nextcloud instance as you mentionned, or you may also want to edit the systemd service (/usr/lib/systemd/system/php-fpm.service) and comment the line ...


10

Got the same error in Linux(Ubuntu 14.04) Check that ini exists /etc/php5/mods-available/mcrypt.ini If it is so, check that you have symlink to ini. Something like in directory /etc/php5/cli/conf.d 05-mcrypt.ini -> ../../mods-available/mcrypt.ini If there is no symlink create it. After installing the php5-mcrypt extension I have no symlink, only ini ...


10

You may want to read these threads: Can't get PHP to stop showing errors php 7 ignores ini files, but claims to load Trouble enabling display_error in php.ini hints: What is "Loaded Configuration File" in php_info output? -> check that you edit the correct ini-file. check for multiple occurences of your setting in the same file. Gryphius´s hint is not ...


9

The reason this happens is most likely that "PHP settings passed with php_value or php_flag will overwrite their previous value", as described PHP-FPM documentation. I assume that in your PHP configuration display_errors is disabled. Then you visit the .net-page, in which your phpinfo() confirms that it is disabled. Then you visit the .com-page and Nginx ...


8

Check what alternatives are there for the php: $ sudo update-alternatives --list php /usr/bin/hhvm /usr/bin/php5 If you don't want to keep hhvm as an option at all, you can do: $ sudo update-alternatives --remove php /usr/bin/hhvm update-alternatives: removing manually selected alternative - switching php to auto mode update-alternatives: using /usr/bin/...


6

The issue was with the restarting of php5-fpm. It seems there is a bug where sometimes some child processes are not terminated upon restart. I had to manually kill the processes with kill <process id> having identified them with ps -ef. I was then able to fully restart php5-fpm which enacted my config changes.


5

If you're using php5.5.x then: $ sudo yum install php55-mysqlnd or: $ yum install php[your version]-mysqli or mysql If you're greater than 5.3: $ yum install php[your version]-mysqlnd


5

If you are not planning to use APC then this can be safely removed from your PHP configuration. First, find your php.ini file and edit it. Find "apc" in the php.ini file, you should find a line that looks like this: extension=apc.so You can comment out this line by adding a semi-colon in front, e.g. ;extension=apc.so If you cannot find the "apc.so" ...


5

session.save_path = "N;/var/www/data/sessions" The doesn't seem to be causing a problem (as PHP is obviously generating sessions), but isn't right. The two formats for this option are: /path/to/sessions N;/path/to/sessions The integer N defines how many sub-directories to create under the specified path, useful to spread the session files out over lots ...


4

You can pass these options to PHP fastcgi from nginx with this syntax: fastcgi_param PHP_FLAG "display_errors=on \n display_startup_errors=on"; fastcgi_param PHP_VALUE "error_reporting=-1"; Note the newline (\n) character that has to be between the passed options.


4

You have two options: Use the -c argument to indicate the ini file location Create a php-cli.ini file on /etc/ From the official PHP manual: The configuration file (php.ini) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI and CLI versions, it happens on every ...


4

Try the following solution: sudo apt-get install php5-mcrypt sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available sudo php5enmod mcrypt sudo service apache2 restart Good luck, -Iulian


4

Found the reason, which is indeed specific to the Elastic Beanstalk container for PHP 5.5. For some obscure reason, the AWS team chose to move php.ini from its original location in /etc/php.ini to /etc/php.d/php.ini. Because the files in php.d are processed in alphabetical order, my app.ini was now processed before php.ini, and was thus overridden. I have ...


4

Looks like just some package name confusion. I believe in both cases, you're attempting "sqlite3" instead of just "sqlite". A: Have you installed sqlite3 on the server? # Note the package on Ubuntu is "sqlite", not "sqlite3" $ sudo apt-get install sqlite B: The PHP package is php5-sqlite $ sudo apt-get install php5-sqlite Lastly To search for available ...


3

There are two options i know of to accomplish at least parts of your goal. First php safe_mode, which might give your Devs a lot of additional work. Suhosin www.hardened-php.net When installed you can edit /etc/php5/conf.d/suhosin.ini and set: suhosin.memory_limit = 512M Qoute from Manual 1: suhosin.memory_limit Type: Integer Default: 0 As long ...


3

If you are having trouble writing/reading files you should review the exhaustive list in this answer: https://stackoverflow.com/questions/12531408/setting-php-tmp-dir-php-upload-not-working Basically, if you want apache to write to a an error_log file other than syslog, apache needs to have permissions to write to it, and if the file does not yet exist ...


3

From official documentation, you should change permission of /var/log/php-errors.log so the file is writable by apache user (e.g www, www-data, etc.) #chown www:www error_log string Name of the file where script errors should be logged. The file should be writable by the web server's user. If the special value syslog is used, the errors are ...


3

You are maybe not using the same php binary in the terminal and in cron, because of a different PATH setting. Enter which php in the terminal and put the full path to the php binary in your cron script.


3

I am not sure if this is standard behavior or not, but you can always add -c /usr/local/lib/php.ini to the command to use a custom config.


3

I know this is an old question that's already been answered. But I wanted to comment here for @harryg and others that come after me. Your issue was with restarting php5-fpm being buggy. As of this writing, the issue seems to have been fixed, and restarting php5-fpm on ubuntu is as simple as running the following command: service php5-fpm restart NOTE: I'm ...


3

As pointed out by @AD7six, I was going about it the wrong way. This is how I solved the issue for anyone else who isn't as familiar with multiple php setups. Copy the default pool to create our new pool. (You can name the pool whatever you want, in this example I am using www2): sudo cp /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/www2.conf sudo ...


3

You can always do this for the cli version: php -c /path/to/your/php.ini and leave the defaults with the ones served over php-fpm. Or even better, add this to your login scripts # ~/.bashrc # aliases and personal functions # PHP source personal ini alias php='php -c /path/to/your/php.ini' # colorize ls alias ls='ls --color' ... It would have been ...


3

Your memcached server(s) should be outside of your ASG. As you know, state cannot be stored in ASG instances. So, either use AWS's Elasticache service or run your own memcached server, then point your ASG instances there.


3

create phpinfo() file in dir with this php file. open it via browser, and find list of applied ini-files. check all of these files to contain session.save_path override


3

You need to add php.ini file: Run temporary php container docker run -d --name php-tmp php:5-fpm Copy php archive docker cp php-tmp:/usr/src/php.tar.xz . Extract php.ini-development or php.ini-production file to config dir. Example: compose_root/php/php.ini-development Add volume with php.ini in php container volumes: .root:/var/www/html:ro ./php/php....


Only top voted, non community-wiki answers of a minimum length are eligible