phpmyadmin gives 500 error - possible memory issue - php

I've got a major issue with PHPMyAdmin since a recent update. If I try to access any PHP files in the phpmyadmin (/usr/share/phpmyadmin) directory I get a 500 error. This even happens if I simply create a
<?php
phpinfo();
?>
file to display current PHP info in the same directory.
I don't have this issue in other directories on my server. MySQL is working fine, and I can create and modify tables manually. WordPress sites on my server relying on MySQL work fine.
I did notice I was getting
Allowed memory size of 262144 bytes exhausted (tried to allocate 7040 bytes) in /usr/share/phpmyadmin/index.php on line 141
However, this doesn't happen constantly and the 500 error happens regardless. I've checked the php.ini files for all types (CGI, CLI, apache2) and all have a 256MB memory limit which seems ample. I tried increasing it to 512MB and restarting apache2 but to no avail.
This only seems to have happened since a recent update about 2 months ago.
Any ideas what might be causing this? Other software on my server such as roundcube webmail, WordPress and others work absolutely fine and do not present errors.
Thanks in advance for any help.
UPDATE As a workaround I've installed a seperate copy of PHPMyAdmin in a different area (without touching the Debian installed version). This works fine so I'm cosidering it a workaround for now. There must be some sort of PHP configuration issue that is denying access to the directory or not allocating any memory at all for one reason or another. Solution not yet determined.

Related

Absurdly high memory allocations with php7.4 under apache windows

What could be the cause of these very unlikely high memory allocations attempts, I notice lately on my production server:
PHP Fatal error: Allowed memory size of 1006632960 bytes exhausted (tried to allocate 51002234388 bytes) in D:\wp\wp-includes\load.php on line 1466
This happened in Wordpress (see error message), but also in Lime Survey.
I'm running PHP 7.4.27 on Windows Apache 2.4.21 on a Windows Server 2008.
The error is consistent (same number of bytes, same script, same line) and remains after a server restart.
Strangely I could get rid of the error in a Lime Survey installation by simply moving all the script files to a different folder.
Edit: Same now: Downloading via FTP all the script files in D:\wp, creating a new directory D:\wp and uploading all the files fia FTP, the error vanished. What's going on here?
Thank you!
The cause is most likely plugin related.
I would check:
wordpress error logs
php error logs
Apache error logs
server error logs
any pending cron jobs.
isolate and debug any plugin DB queries.
are there any heavy reports (DB generated)
Isolating which plugin, can be done by using a live backup, and deleting/disabling plugins one at a time.
Increasing the memory limit may be done through wordpress, but may not bite, unless configured on the server or php level.
1 - check PHP 7.4 memory limit
(check php.ini -- check folder configuration
in the windows)
2 - Insert memory limit in wp-config.php
3- insert the memory limit in .htaccess
4 - Check the plugins.
5 - Possibly have a hidden malicious code file
( 5.1 - look for files with the same name as the folder. Example: FOLDER = theme (when entering the folder) there is a file with the name = .theme.php
5.2 - Analyze your index.php, wp-config.php or .htaccess (if they were not auterated, enter codes)
6 - Analyze the logs
Now, after a while I strongly guess it was the opcache functionality, that caused the error. Maybe after updating some of the scripts did conflict with left untouched ones in the opcache.
Turning off the opcache did the trick (till now :)).

PHP file uploading doesn't work over 65KB

I have a VB.NET software that uploads files using an HTTP request to PHP. This worked fine until May but now it fails when uploading files over 65KB. I can not tell when it stops to work exactly. Even though, I don't think it is relevant. So to be clear, uploading a file under 65KB works correctly.
I looked with my hoster and he doesn't see any error neither do I on the server (the part I have access). VB.NET doesn't give me a pertinent error, but using WireShark, I've been able to get either a 500 or a 400 error. But it didn't give me clues on what is failing.
I verified this question which is not solved, though the things said there are OK on the server too.
PHP not uploading file over 55 kb
I have another option to fix it: splitting my files in chunks of 50KB and rejoining them via PHP. Though, I rather understand what is happening because this can happen again even with chunks of 50KB.
Server is Apache/2.4.28 (Unix)
EDIT 1
I have new conditions: I now have my own server running on Windows + Apache 2.4 + PHP 5.6.
Now it goes a little farther. I have an error when using move_uploaded_file function that gives me: Error #3: The uploaded file was only partially uploaded. It is coherent with the file being stopped to be sent near the end. So I now receive an HTTP 200 response but a failure after ward even though I suspect not being there.
I can certify I did not stop my VB.NET software that is uploading the file.
I tested changing KeepAlive to Off/False on both sides. No luck :(
Tried to add header ("Connection: close"); in my main file (that is used for all transactions with this VB.NET software). No luck.
Even though, it is not currently an issue, I changed (PHP configs) the upload_max_filesize to 256M and post_max_size to 300M (because it will be a problem if a can figure out this one).
I got those suggestions from : https://wordpress.stackexchange.com/questions/176465/failed-media-upload-the-uploaded-file-was-only-partially-uploaded
The only one I could not try is replacing an apache/php module which doesn't seem to exist on Windows.
Depending on your server's configuration, when an error 500 is returned an error_log is written. The problem is with the error 400. Which according to wikipedia's list of HTTP codes is actually a BAD REQUEST. Some output from your error_log when the attempt is being made might put us in the right direction.

Apache in MAMP Pro 4 has stopped working, refuses to start

Have been using MAMP Pro for a fair while - version 3 primarily, upgraded to 4 a while ago.
I haven't had any unusual issues at all, but today the Apache service failed to start, telling me to check the error logs. The logs were blank unfortunately... I've made no system configuration changes, no changes to MAMP/MAMP Pro. Shut down my system yesterday, started today, it no longer works...
I've tried numerous suggestions found via Stack Overflow and Google without any success.
Even after completely uninstalling and re-installing MAMP Pro I am unable to get the service to start.
Nothing appears in the logs...
When starting it manually on the command line it comes up with a PHP related error:
$ Applications/MAMP/bin/apache2/bin/apachectl start
httpd: Syntax error on line 135 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so into server: dlopen(/Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so, 10): image not found
The confusing thing is that I don't have PHP 5.2.17 specified anywhere, at all - according to MAMP Pro it should be using PHP 7.0.12.
If I add PHP 5.2.17 to MAMP using the appropriate MAMP Pro dialogs, Apache still fails to start via the MAMP Pro interface. I can now start it manually from the command line however, but none of my virtual hosts/etc seem to be loaded.
apachectl -V tells me it's using /Applications/MAMP/conf/apache/httpd.conf, but there is nothing in that file that has any reference to any of the configs generated in /Library/Application Support/appsolute/MAMP PRO/conf
It also looks like hosts entries aren't added to /etc/hosts.
Even if I tell /Applications/MAMP/conf/apache/httpd.conf to do nothing but include /Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf (and manually add entries to /etc/hosts) it still doesn't seem to work at all...
I and my colleagues are at a complete loss, especially given it was working yesterday...
Has anyone had any issues like this?
I managed to fix the similar issue you had.
My Apache server was working fine and then following updating to 4.0.6 I experienced similar issues.
There were 2 things I did to fix the issue. I was getting the same error where it couldn't find a php file in 5.2.17. After fixing that by adding 5.2.17 to MAMP I experienced an apache error regarding user permissions.
(22)Invalid argument: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
File > Edit Template > Revert ALL Templates to Default Settings.
Save & restarted the servers and all worked finally and all my hosts had retained as well.
I had previously entered a custom line in my httpd.conf file that for countless versions had copied across fine however it looks like the folder structure had changed and so couldn't locate it causing the unusual error about User permissions. I have since re-entered the custom line with the correct structure and all working fine again.
Hope this helps.

Error 500 when trying to import large file .txt to MysQL

We're using Yii framework for an internal tool.
What we have now :
The user select a file .txt to upload on the server.
The server clean the text file because it containts lots of characters such as """ and ;;;;
But when comes the time to import to database, server sends a 500 internal error with no more information.
The file size is 8.1 mo. The import seems to work if we delete manually some rows in order to make the file at less than 7 mo.
We took a look at the php.ini file and increased all the limits.
What is weird is that we made local server with easyphp (same config in php.ini) and it works.
Do you have an idea ??
Thanks !
With the information's you have provided, I can only suggest that turn on error_reporting and display_errors in your php.ini file.
Increase maximum execution time and then see if any error displays or not?
Also do you have access to your log files in server? Then check php error_log for more information.
Do you have some error logging (preferably written on the server, as the 500 pages generally not show the error).
Many servers are configured to return a 500 internal error in case of an error in a mysql_query. So either there is omewhere in the 8MB in issue (which does not appear to be the case, if it works in exactly the same table on another server), or the query is too long (increasing the limits is not always possible on a shared server).
If you share some code and/or error message that may help to find the issue.
There is also a limit on the SQL server, defined by max_allowed_packet. Please take a look on the result of
show variables like 'max_allowed_packet';
Maybe this is set to low.

imagefill() causing 'Premature end of script headers'

I'm posting because after hours of searching I'm utterly confounded. Here's the deal. My Laravel application uses the PHP Image Workshop bundle. Everything seems to be working fine, except if I try to make a resizeInPixel() call or a cropInPixel() call (or similar calls) the server throws an internal server error. If I investigate the error log I see:
Premature end of script headers: index.php
This only occurs when I use the resize and crop related methods (i.e. image processing). I can initFromPath() with no issue, and I can use the save() method without issue. Only the image processing methods cause the internal server error.
I've also read online that this can be the result of a suphp_log file exceeding 2GB. I've tracked down and cleaned out that file, but to no avail.
Any thoughts are most welcome! Even if they're just general "have you tried...".
UPDATE
I've narrowed it down to a particular line in the Image Workshop code. This line is causing the error:
imagefill($image, 0, 0, $color);
Additionally, this error only occurs when the color is created using imagecolorallocatealpha, NOT when it is created using only imagecolorallocate.
There are some great hints for solving this issue at Liquidweb.com. My money is on #2 (see bold text) because you are getting the error when doing image manipulations:
Sometimes when executing a script you will see an error similar to the following:
Premature end of script headers: /home/directory/public_html/index.php
This error occurs because the server is expecting a complete set of HTTP headers (one or more followed by a blank line), and it doesn’t get them. This can be caused by several things:
Upgrading or downgrading to a different version of PHP can leave residual options in the httpd.conf. Check the current version of PHP using php -v on the command line and search for any lines mentioning another version in the httpd.conf. If you find them, comment them out, distill the httpd.conf and restart apache.
The RLimitCPU and RLimitMEM directives in the httpd.conf may also be responsible for the error if a script was killed due to a resource limit.
A configuration problem in suEXEC, mod_perl, or another third party module can often interfere with the execution of scripts and cause the error. If these are the cause, additional information relating to specifics will be found in the apache error_log.
If suphp’s log reaches 2GB in size or larger you may see the premature end of scripts headers error. See what the log contains and either gzip it or null it. Restart apache and then deal with any issues that the suphp log brought to light. The suphp log is located at: /usr/local/apache/logs/suphp_log
The script’s permissions may also cause this error. CGI scripts can only access resources allowed for the User and Group specified in the httpd.conf. In this case, the error may simply be pointing out that an unauthorized user is attempting to access a script.
UPDATE:
After some more info in the comments, I still feel this is a memory related thing.
According to this SO wiki: About gdlib
Warning: Image functions are very memory intensive. Be sure to set memory_limit high enough
What is your PHP memory_limit? Can you crank it up a bit?

Categories