New answers tagged

0

I have fixed this issue by doing the following: sudo tailf /var/log/php5-fpm.log This gave me valuable feedback about a pool not being able to listen grep "\[www\]" *.conf This revealed that I had multiple .conf files that contained [www], I fixed this and restarted php5-fpm and nginx and the 502 errors disappeared and I was able to give the rogue ...


0

For me it turned out to be xdebug configuration. I'd been working to enable xdebug a few days ago to no avail. Nothing was even taking effect (affect?) Last night it hit me that perhaps xdebug was hanging. I commented out the xdebug configuration, restarted PHP5-fpm and things freed up. I, unfortunately, didn't see anything in any of the logs to point ...


1

Not really. When a php-fpm child is executing a code referring to an external URL, and that URL doesn't answer [in time], the code blocks for some configured timeout (for example curl connect timeout), so the child blocks and waits too, unable to serve the php-fpm socket. When all the children enter that state, you get a 504 status on your site. By the way, ...


0

As @Mugurel said, 'mysql' has been depreciated. To get my repertoire of tools working, I compiled with ./configure --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd (among the other options I use). Your configure options are a bit different, so perhaps you'll have luck massaging them a bit. Unfortunately, I haven't yet seen solid documentation ...


1

This is because of the try_files madness and other questionable approaches. Remove all of your exercises and make it canonical: location / { index index.html; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php; } } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME ...


0

It's not always that the SCRIPT_FILENAME is wrong. It may also be PHP is running as the wrong user/group. This example is specific to Mac OS X, which in my experience is the most troublesome to setup (Debian is easy by comparison) - I've just upgraded from PHP 5.6 to 7.0, using homebrew and the excellent josegonzalez packages. The problem was that a new ...


2

You will also need to run: apt-get install php5-cli=5.3.10-2 php5-fpm=5.3.10-2 php5-common=5.3.10-2 php5-readline=5.3.10-2 These were still on the 5.6 version, that's why you still see 5.6.


2

location ^~ is not a regex location, it is a prefix location that takes precedence over all regex locations. See this document for details. What you probably want is: location ~ ^/vexim/.*\.php$ { ... } location ~ \.php$ { ... } Make sure that the /vexim location comes first as regex locations are ordered.


2

Running PHP is expensive, in terms of CPU usage and RAM. Any time you can avoid invoking the PHP interpreter, you should. Caching is the primary way you do this, so long as the content isn't custom generated for every user. My little AWS t2.micro can serve around 2500 pages per second from its Nginx cache, but about 20 pages per second if PHP (HHVM) has to ...


1

Most of slow php pages could be traced to database issues. You might want to create a script that runs only 1 query, and print the time needed to execute the query. Please see http://stackoverflow.com/questions/17035859/how-to-find-php-execution-time for ways to record execution times. Do record execution times in parts in your script, from there we would ...


0

I have downloaded PHP 7.0.2 and the mysql folder is missing from the ext directory. Looking further into this I realized they removed this function: https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7 It works on PHP 5.5 because it was only DEPRECATED in it, but it seems now they've completely removed it. According to the wiki, it's available ...


1

A 3 second Google bought up a page that answers all your questions - you just need to raise that limit. Did you try Googleing "pm.max_children" before you posted your question?


0

To answer your TLDR, no that can't be done in PHP itself. There is no global setting that can be changed for all outbound traffic like file_get_contents/etc. As you stated you can customize the interface for curl and several other packages/ components, but there's nothing to globally set it. Mark Strosberg's answer should work for curl!


0

When PHP display_errors are disabled, PHP errors can return Nginx 500 error. You should take a look to your php-fpm logs, i'm sure you'll find the error there. With CentOS 7 : tail -f /var/log/php-fpm/www-error.log You can also show PHP errors. In your php.ini, change : display_errors = Off to : display_errors = On Hope it helps.


0

In your Nginx configuration, you can add this, setting the number to the desired IP. fastcgi_param CURLOPT_INTERFACE 1.2.3.4; This will populate the $_SERVER variable inside the PHP script. In your PHP script, set CURLOPT_INTERFACE to $_SERVER['CURLOPT_INTERFACE']; I've not tested this, but I think it should work.


2

Have you tried RewriteRule with [H= instead of SetHandler? RewriteRule would have the advantage of evaluating arguments when it's executed rather at startup (typical directives do not interpolate per-request variables when they actually execute)


-2

Installing php from another repo then centos, is rather straightforward : (This is the example for webtatic repo) Install the repo's rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm Remove any already installed package from the official repo's yum remove php-* Install the ...



Top 50 recent answers are included