Changing Maxclient setting in php heroku - php

I am new to heroku,i am getting the below warning in server logs. I have just uploaded my php scripts into the heroku through git I am not sure where my Maxclient setting is present too..
server reached MaxClients setting, consider raising the MaxClients settings
I saw in many posts to chnage Maxclients in httd.conf. I am not aware of the apache server folder sturucture. Can you please let me know in which path should i keep the httd.conf and also the format of it. You can also direct me to any posts which explains it well

i found the answer.. followed the usage instructions in github.com/heroku/heroku-buildpack-php
and my php code was found to be /app
Later created httd.conf file inside /app/apche/conf

Related

How to diagnose file upload failures in SilverStripe running on Apache

I am facing a pretty common situation judging from the questions either here on SO or in the SilverStripe forums: file uploads fail.
However, my situation seems to stem from an issue that I haven't met yet on the Web; from reading other questions and many blog articles or forum threads, I have ruled out:
Permission problems
upload_max_filesize and post_max_size in the PHP configuration (both set to 8M)
LimitRequestBody in the Apache Configuration (default value of 0, meaning "unlimited")
I have ruled these out for many reasons but this picture shows with an example of three consecutive uploads that the uploads are sometimes working:
I have also started a thread on the SilverStripe forums for this problem, but I have little hope of having luck solving the problem there.
I have set up breakpoints in the Upload, UploadField and File classes, and stepped through the code for hours without succeeding in identifying the cause of the error.
My finding so far is that any file above 128 kiB causes an internal server error. Any file below this size threshold gets uploaded as expected.
All logs (Apache, PHP, SilverStripe) are totally mute when this error occurs.
A permission issue seems very unlikely because:
PHP runs in Fast-CGI mode as a user (web1) created by ISPConfig
Apache runs as user apache:apache
I have added apache to the group of user so that groups web1 gives me web1 : client1 sshusers and groups apache gives me apache : apache ispapps ispconfig client1
the upload folder (assets) is owned by web1:client1 and has permissions 775
the temporary upload folder (upload_tmp_dir) is owned by web1:client1 and permissions are 775.
I believe what I'm looking is a means of somehow getting information about where and why the uploads fail. Is it possible to set the loglevel of Apache to "debug" or "trace"?
NOTE: an entry in the "Similar Questions" led me to this answer, which hints at SSLRenegBufferSize being by default at exactly 128 kiB. Unfortunately, whether the protocol is HTTPS or HTTP has no influence: the problem shows up.
[EDIT] I had later on set the LogLevel directive to trace but I still had no message about this error in the server logs.
Quick googling took me to the following articles:
Debian Jessie - Apache2 / PHP 5.6, can't upload more than 128kb
https://wordpress.org/support/topic/cant-upload-images-larger-than-128kb-http-error
Those suggest to check FcgidMaxRequestLen setting value.
This doesn't answer how to debug that correctly but helps solve the original issue.

Mysterious 503 Error with PHP/MySQL File/Database Sync

I am hoping you all can help me out a little. I have spent about 7 hours trying to find an answer and have tried many things so far.
I have a PHP script that is used to sync files/database data between 2 servers. Before you guys ask this process is necessary for this project and must stay in place.
The script basically finds all files in a directory that have changed in the last 72 hours and SFTPs them to the other server, replacing any files needed. It then creates a copy of the backing database, removes certain tables/rows, changes others and exports a .sql file. It then SFTPs this .sql file to the other server and calls an include on a file on the 2nd server that imports the .sql file replacing the existing database with updated data.
All of this works...
The issue is that no matter what changes I make to the Apache config the script always gives me a 503 error after 30 seconds, every time (between 30.02 and 30.04 seconds to be precise). However, the PHP script continues to run and successfully completes all operations, including writing to the log file, in about 60-61 seconds. There is nothing in the Apache logs referencing any kind of error at all either.
I have checked all .conf files used and none of them mention a 30 second timeout. In my httpd.conf I have added these lines:
TimeOut 300
ProxyTimeOut 300
KeepAlive On
KeepAliveTimeout 60
I also have set the max_execution_time and memory_limit on the php script to 120 and 2048M, respective, to be sure to rule that out during testing.
The page is supposed to display a success message to the user with a report of what was changed/updated. However with the 503 error I am not able to do this. So I am looking to get rid of this 503 limitation so it can properly display the end result of the sync. I am not too familiar with Apache configuration to be honest so any help/ideas on what would cause this/where to look would be much appreciated!
Thanks in advance!
After trying many, many things I was able to find out what the specific cause was. It turns out this was caused by the proxy timing out. Here is a link to the answer that explained what to add to the vhost conf file.
In short, here is the answer for future visitors:
For the latest versions of httpd and mod_proxy_fcgi you can simply add
timeout= to the end of the ProxyPassMatch line, e.g.:
ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1 timeout=1800
For older versions it was a little more complicated,
e.g.:
<Proxy fcgi://127.0.0.1:9000>
ProxySet timeout=1800
</Proxy>
ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1
Not sure if you tried this, but I think you may need to adjust max_execution_time in the php.ini that Apache uses. On many distributions it defaults to 30.
http://php.net/manual/en/info.configuration.php#ini.max-execution-time

Premature end of script - causing internal error 500 of php files

first I wish you a happy new year!
I got the following problem:
I receive an Internal Error 500 when trying to open one of my websites on my server which uses .php files. All Domains configured on this user don't work. The Domains configured on other users are working fine.
Checking out the error log gave me the error "Premature end of script". Until yesterday everything worked fine and I haven't made changes since than.
I checked out the following possibilities:
APC in php.ini -> doesn't exists in my php ini (https://www.drupal.org/node/213260)
File Permissions (500 Server error: Premature end of script headers:)
RLimitCPU and RLimitMEM
some other things with general configuration, but they can't be the reason because my other sites with php are working fine
I compared the Apache config of the different domains but couldn't find a relevant difference. Unluckily I changed the rights of the files in this directory and now my ftp isn't working anymore (set them to 705). Any Ideas on both problems?
Server is CentOS 6.7 with PHP 5.3.3 and Webmin Interface
FTP Server is ProFTPD
Thanks in advance!
I solved the problem with the premature end of script. The quota of the user was more than full, which was done by a failure in a cronjob. facepalm

phpBB 500 Internal Server Error and no log outputs

Good morning. I'm having a major issue with my phpBB installation.
I've transfered it to my computer to develop some plugins, so i'm running it on localhost, but, i've created a vHost with the exact same domain he is running online, so, i don't need to change the cookies configuration, and the database connection information is correct already.
Regard all of that, i'm getting a 500 internal server error, which displays no error on the screen nor the logs from apache and php.
I have error reporting on php as E_ALL also. What could be possible causing this, and what the solution might be?
Thanks in advance, Jorge Ferrari.
If you're getting nothing in the Apache / PHP error logs, then it's more likely to be a server configuration issue. I would suspect the problem is in a file called .htaccess in the phpBB folder. It can be used to customize the configuration in various ways, including things like setting up redirects and URL rewriting.
If the htaccess file tries to use an Apache feature which isn't available on the server, then it can generate a 500 error. You can test this by temporarily removing the file, and seeing if the website works at all (albeit possibly with some glitches).
If you've confirmed that it's the source of the problem, then ideally you'll need to enable the missing feature in the server's configuration (or possibly update the Apache installation). Alternatively, you can delete or comment-out the problematic bits of the htaccess file.
Either way, it sounds more like a webserver admin issue than programming. You might have more luck asking on the phpBB forums, or on a different Stack Exchange Q&A site (possibly Server Fault?).
Check whether you have Rewrite module enabled?(most of the this will be the reason)
In httpd.conf and uncomment
LoadModule rewrite_module modules/mod_rewrite.so
If you try to use module which is not loaded you will get 500 internal server error.
Check your modules used in .htaccess file and check httpd.conf whether used modules are loaded

How can I fix the MediaWiki error "Wiki uses cookies to log in users. You have cookies disabled. Please enable them and try again."?

The problem I am having is that I can not log on to my newly created wiki that I made using MediaWiki. I have searched the web for an answer, and the ones I found did not help with this specific issue (like this one: problem with mediawiki cookies) I have tried with multiple browsers and changed the setting to make sure that cookies are enabled, but I keep getting the same error:
"Wiki uses cookies to log in users. You have cookies disabled. Please enable them and try again."
I'm not sure whether this is a problem with my current version of PHP, which is currently 5.3, or a setting in my wiki.
I found a fix, I'll put it in steps:
Open LocalSettings.php
Go to the bottom of the page, and enter in the following code: session_save_path("tmp");
Create a directory called tmp in the folder where you have MediaWiki installed.
If you are using NGINX + PHP-FPM the previous answers will likely not solve your problem.
From my experience, this issue is caused when php-fpm doesn't have write access to the cookie_path. You can find this path by running:
php-fpm -i|grep --color cookie_path
See what your cookie_path is, then stat the folder and ensure your php-fpm user has write access to it.
To resolve this issue using Nginx and Php-Fpm, I had to change my cookie_path from it's default of / (seriously, why would this be a default?) to /tmp.
After restarting nginx and php-fpm, it works perfectly.
The easiest solution, also recommended by Aaron Schulz, is generally to set
$wgSessionsInObjectCache = true;
$wgMainCacheType = CACHE_ANYTHING;
in your LocalSettings.php. In recent PHP you'll have OPcache enabled by default; if no accelerator is available, at worst this configuration will use the database.
See also cache documentation.
I also had this issue ...
All my browsers were complaining about cookies being turned off....
I thouhgt a group policy had been implemented to disable cookies.
After conferring with my server support team that nothing as such had been implemented I decided to remote to the server.
The server was complaining about low disk space.
I cleaned up the disk by deleting some old unrelated files.
Tried to logon again from my browser and all was Ok.
One answer which hasn't been mentioned here - make sure your file system isn't out of space.
same thing may happen when memcached is used to store session files. in this case wiki will be unable to write cookies neither in / neither in /tmp. if you see in error.log something like
"file not found (11211:9001/qweqweqweqweqe)" this will mean, that you have memchached installed and configured and you need to append the following lines in LocalSettings.php:
$wgMainCacheType = CACHE_MEMCACHED;
$wgParserCacheType = CACHE_MEMCACHED; # optional
$wgMessageCacheType = CACHE_MEMCACHED; # optional
$wgMemCachedServers = array( "127.0.0.1:11211" );
$wgSessionsInMemcached = true; # optional
Just ran into this issue on a Win2008 R2 server running IIS,
when creating a user gave this (red) msg:
Account creation error The user account was not created, as we could
not confirm its source. Ensure you have cookies enabled, reload this
page and try again.
Also if a user tried to log into the Wiki, they would get this (red) msg:
Login error (WikiName) uses cookies to log in users. You have cookies
disabled. Please enable them and try again.
Failed attempts:
I tried JesseG17's solution, but could not save changes to the
localsettings.php file (despite stopping the server).
I checked permissions on the temp location, but that didn't help.
I changed tried changing the temp location via IIS's PHP manager, but
that didn't change anything.
What finally did work was to use IIS's PHP manager to change the
MediaWiki's PHP settings; session.use_cookies from 0 to 1
This solved the problem without any reboot.
Be root:
su -
Then edit the php.ini file:
nano /etc/php5/apache2/php.ini
And set those variables to /tmp:
session.save_path = "/tmp"
session.cookie_path = "/tmp"
You can also correct the permissions just in case:
chmod -R 1777 /tmp
I'm adding a new answer because my setup was slightly different, and the steps I took were similar but not identical to everyone else's.
I installed MediaWiki on CentOS with NGINX. After running it successfully for a few months, I started to get the same cookie error out of nowhere.
The issue I had was that the php-fpm user lacked access to the session.save_path folder. I don't know why it happened, but here's now I fixed it.
I ran a variation of SprintCycle's command to identify where the sessions were stored:
php-fpm -i|grep --color save_path
In my case, it was /var/lib/php/session.
Then I changed directories and set permissions:
cd /var/lib/php
chmod -R 1777 session
I restarted the services, and everything worked again.
service nginx restart
service php-fpm restart
Another thing to check is if your session tmp directory is full. Symptoms are "write failed" messages in your http server error log. Duh!
I had to uncomment the wgCookieSecure setting in LocalSettings.php:
#$wgCookieSecure=true;
only found this after having checked that another wiki on the same computer ran just fine with similar settings. So to debug you might want to install a fresh mediawiki in a neighbour directory and check whether that gives you any trouble. Then you can go thru all the suggestions here as well as the one at
https://www.mediawiki.org/wiki/Topic:Rg3w5u0e70fs8l4e
Put
$wgDisableCookieCheck = true;
in your LocalSettings.php.
(source)

Categories