Hot answers tagged

30

For Mac OS X, this is what I do: Make a script /usr/local/etc/php/fpm-restart: #!/bin/sh echo "Stopping php-fpm..." launchctl unload -w ~/Library/LaunchAgents/homebrew-php*.plist echo "Starting php-fpm..." launchctl load -w ~/Library/LaunchAgents/homebrew-php*.plist echo "php-fpm restarted" exit 0 Then: chmod ug+x /usr/local/etc/php/fpm-restart cd /...


22

Usually, service php5-fpm restart will do fine, on an up-to-date distribution. But somtimes, it fails, telling you restart: Unknown instance: (or such). Now, if you do not like to reboot your server, just kill the processes and have a fresh start (edited as of here): $ sudo pkill php5-fpm; sudo service php5-fpm start


15

On ubuntu, I believe the command is: sudo service php5-fpm restart You can find the service name by doing: sudo service --status-all | grep -i fpm


14

PHP 5.5 has built-in opcode optimizer OPcache making APC obsolete. According to APC changelogs, PHP up to only 5.4 is supported. Please use OPcache with PHP 5.5+ http://www.php.net/manual/en/opcache.installation.php


12

You need to restart it. I use 7.0 so change the 7.0 to your version. sudo systemctl restart php7.0-fpm


12

For Mac OSX brew services restart php56 worked for me.


12

It could also mean that /etc/php5/cli/php.ini (on Debian/Ubuntu) or /etc/php.ini (on RHEL/CentOS/etc.) has display_errors = Off which means that any errors or warnings from command-line scripts will go nowhere, unless log_errors = On (see also the error_log setting). Try running your scripts with a wrapper script that uses php -d display_errors=on ...


11

I had a problem restarting php7-fpm, because I didn't knew how exactly the service was named. This function gave me the answer: service --status-all php7-fpm service in my Ubuntu was called php7.0-fpm, so I did: service php7.0-fpm restart


11

When I run yum whatprovides */evp.h, I get several packages that provide this file, all different versions of openssl-devel. Did you yum install openssl-dev or openssl-devel? If the former, that's the wrong package name.


11

This happens because, in most web servers, the default action for folders is "Directory listing" which is disabled by default. The same would happen in Apache usually if you disable Directory indexing. What you can do in nginx is to put =404 at the end of your try_files directive. You can do this by putting /index.php at the end of the try_files directive. ...


11

First check installed extensions in php with following command php -m After enter check Do you find follwing xml list? xml xmlreader xmlwriter if not then add following line apt-get install php5.6-xml After doing so, make sure to restart appache service apache2 restart Hope this will help you.


10

Carry out the following: apt-get install php5-imap However it's not enabled by default so enable it with: php5enmod imap Then bounce apache: service apache2 restart Done.


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

First you have to remove Apache and all of it's dependencies. apt-get purge apache2 php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql phpmyadmin and then rm -rf /etc/apache2; rm -rf /etc/php5; rm -rf /var/lib/mysql; rm etc/mysql And then reinstall. If you have any issues with phpMyAdmin, try entering this into the Terminal: ...


8

php.ini-development file for php7 on ubuntu 16.04 is located in /usr/lib/php/7.0/php.ini-development So you can do the following: make backup copy of your current php.ini: $ sudo mv /etc/php/7.0/apache2/php.ini /etc/php/7.0/apache2/php.ini.back then copy production ini file: $ sudo cp /usr/lib/php/7.0/php.ini-development /etc/php/7.0/apache2/php.ini ...


8

This is seems to be covered fairly well in install.txt included in the PHP zip downloads. Quoting from that file ... Manual Installation Steps ... Upgrading from a previous PHP version: Previous editions of the manual suggest moving various ini and DLL files into your SYSTEM (i.e. C:\WINDOWS) folder and while this simplifies the ...


7

Your php-fpm.conf file is not set up to send errors to syslog. See below for an example of how to do this. ; Error log file ; If it's set to "syslog", log is sent to syslogd instead of being written ; in a local file. ; Note: the default prefix is /var ; Default Value: log/php-fpm.log error_log = syslog ; syslog_facility is used to specify what ...


7

This was due to an OOM (out of memory) event causing the compiler process to be killed which I was able to determine with 'Some Linux Nerds' help. To circumvent this when you can't just add memory to the machine, I used a swap file. Here are the commands I used that I found here: dd if=/dev/zero of=/swapfile bs=1024 count=262144 mkswap /swapfile swapon /...


7

It's better to upgrade to php7. Install php7.x-fpm and use the mpm_event (or mpm_worker) module: apt-get install php7.x-fpm # install the php-fpm a2enmod proxy_fcgi a2enconf php7.x-fpm a2dismod php7.x # disables mod_php. a2dismod mpm_prefork a2enmod mpm_event # enable event MPM. You could also enable mpm_worker.


6

php-fpm will restart if you send a USR2 signal to the main process: sudo kill -USR2 php-fpm_main_process_id So we just need to instruct php-fpm to record its pid somewhere. In this example, I'll assume you want to save it at /etc/private/php-fpm.pid, and that php-fpm runs as user _php. First, add this line to the configuration file: pid = /etc/php-fpm.pid ...


6

APC doesn't have support for PHP 5.5, the last version it was updated to work with was 5.4, and it hasn't seen updates since except for bug fixes in 2012. If you did want to make it work with 5.5 you could try redefining IS_CONSTANT_ARRAY and IS_CONSTANT_INDEX to be IS_CONSTANT_AST since this has superseded them, however that's no guarantee of success if it ...


6

I had the same error after updating my server and found the following error in /var/log/nginx/error.log:/var/run/php5-fpm.sock failed (13: Permission denied) What solved the issue was uncommenting the following lines in /etc/php5/fpm/pool.d/www.conf and restart php5-fpm listen.owner = www-data listen.group = www-data listen.mode = 0660


5

This appears to do the trick: Download & unarchive PHP source. Ensure libpq5 and libpq-dev are installed. cd php_x.x.x/ext/pgsql phpize ./configure make sudo make install edit php.ini to add extension=pgsql.so and any necessary other pgsql directives. Restart apache.


5

Other problem is memory usage. When a process is created, 80M is allocated for apache2. I think is too much. Is that real or virtual memory? Honestly, it's not very much; more to the point, you should focus on fixing things that are causing problems, not just things that you "think" should be different. If you want Apache processes to take up less memory, ...


5

I finally figured this out. The problem was a conflict between two plugins installed on the site (and specifically in the way the two plugins were configured.) The iThemes Security plugin (http://ithemes.com/security) is configured to make site backups periodically. The code to make the DB backup does a dump of every table in the database, and it assumes ...


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

/tmp/apc.XXXXXX -> This mmap file mask is a normal filesystem based mmap and uses mkstemp to create a unique temporary file which is mmap'd. The 6 'X's are replaced by the unique string to make the filename unique. This is just writing data to a file in filesystem. /tmp/apc.shm.XXXXXX -> Note that it_must_ be only /apc.shm.XXXXXX on linux systems. The ...


5

You installed PHP 5.4, but the PHP functions you are trying to use were introduced in PHP 5.5. Use the remi and remi-php55 repositories to update your system to PHP 5.5 (or choose a later version). It should be sufficient to install the appropriate remi-release RPM, enable the remi and remi-php55 repositories, and then yum update.


5

Have you installed mysqli? If not, you'll need to run: yum install php-mysqli If that doesn't work anymore, you could try easyapache and select mysqli.


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


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