In my php script I restore db2 database backups. They are getting bigger and bigger. So now I was getting 500 Server Error after +-30min after executing the script. There was this line in (mod_fastcgi.c.3352) response not received, request sent: 634 on socket: tcp:127.0.0.1:9090 for /wrational/restoredb.php?mode=restore&database=RATIONAL, closing connection in php-errors.log file.
I thought that setting `set_time_limit(6000);1 would solve the issue but it hasn't.
Increasing default_socket_timeout in php.ini file did the trick.
Is there any way to change default_socket_timeout from php code?
With this PHP command:
ini_set("default_socket_timeout", 6000);
Or add/update the .htaccess file with this line:
php_value default_socket_timeout 6000
Check the current value with phpinfo()
beware of the fact, that php has a bug with default_socket_timeout and SSL. It will wait endless in case you use HTTPS/SSL.
https://bugs.php.net/bug.php?id=41631
you can add/update the .htaccess file
line php_value default_socket_timeout 6000
Related
I know this question can be found a lot of time on this forum and the internet. But I can't seem to find the answer to my specific question.
I'm running a Drupal website, and since the update of MAMP from 5.5 to 5.6 I get the following error:
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) when running a composer require in the terminal.
I updated the php.ini tot 1024MB instead of 128MB of the current php version I'm running via MAMP. When I add a php file to my root with <?php phpinfo(); ?> I see that the memory is like I want so 1024MB. When I look at the location of the php ini file I see it is in the MAMP folder.
But I still get the error. When I run this php -r "echo ini_get('memory_limit').PHP_EOL;" in my terminal I see the 128MB again. When I try to find the php ini that is running using
php -i|grep 'php.ini' I get:
Configuration File (php.ini) Path => /etc
So it looks like the php.ini file is somewhere else. But I don't know where and can't change it. How can I solve this?
I also tried changing the composer memory using php -d memory_limit=-1 /usr/bin/composer but this didn't solve the problem either.
My question is, how can I solve this problem? How can I find the php.ini file that is used. Or how can I change the memory limit?
Update:
Running php -i | grep 'Configuration File' in the terminal ouputs:
Loaded Configuration File => (none)
And maybe good to know that I have the option Make this version available for command line enabled on the MAMP php section.
I tried many of the suggestions on this and a few other stack overflow questions but couldn't get it to work until I tried:
COMPOSER_MEMORY_LIMIT=-1 composer require 'yourpackagenamehere'
Just trying COMPOSER_MEMORY_LIMIT=-1 by itself before running the command didn't seem to work. Not sure why, but I had to run them on the same command line in a similar way as documented in the composer troubleshooting: https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors
I ended up adding a php.ini file to the /etc folder on my computer. This way the php memory_limit raise did work. And checking it in the terminal did show me the right value. But as Alister already said, this didn't fix the problem. The problem was not in the php.ini memory_limit.
I found out that using COMPOSER_MEMORY_LIMIT=-1 in the terminal at the beginning of my session put the memory limit to unlimited during that terminal session. This fixed the problem.
After that I added, alias composer="COMPOSER_MEMORY_LIMIT=-1 composer" to my bash file and know everything is working like I would expect.
Changing the amount of memory in php.ini won't help - that is the limit for what is being used by the webserver's version of PHP - and having too much available for the webserver can cause problems (at least when running in production).
Composer, when it is being run from the command line, will, by default set the limit to 1,610,612,736 bytes - 1.5 GB.
As you are apparently still on PHP 5.6, that's also a very considerable problem. PHP 7+ is a great deal more efficient with memory, as would be an up to date version of composer.
Finally, to actually solve the problem: Restrict your requirement to be more specific since that keeps memory usage lower.
I am trying to export my db as a graphml file via the apoc.export.graphml procedure in Neo4j 3.1 + 3.1.0.3:
call apoc.export.graphml.all("test",{})
I get this error message:
Failed to invoke procedure apoc.export.graphml.all: Caused by:
java.lang.RuntimeException: Import from files not enabled, please set
apoc.import.file.enabled=true in your neo4j.conf
I have edited my neo4j.conf file to add
apoc.import.file.enabled=true
at the end of the document but I'm still getting the same error message.
What am I doing wrong?
Thanks for your help.
I had the same problem and did not find any from anywhere. I just managed to resolved this issue. Hopefully, this solves yours as well.
Environment: MacOs, Neo4j 3.1.2 CE
1) Change your .neo4j.conf (mine is under my ~/Documents/Neo4j/). You can easily edit by pressing [Options...] button. I commented the import directory comment out as well, just in case.
#dbms.directories.import=import
apoc.import.file.enabled=true
2) I originally have the apoc-3.1.2.5.jar under ~/Documents/Neo4j/default.graphdb/plugins/ directory which worked except reading xml from the local disk. So, I put the jar under my app directory, /Applications/Neo4j.app/Contents/Resources/app/plugins
The "Neo4j.app" is my symbolic link. You probably will see the app directory as "Neo4j Community Edition 3.1.2.app"
3) Do Not restart by pressing [Stop] and [Start], make sure you quit the Neo4j and relaunch. Stop and Start seems to reload config but it does not seem to load jar from plugins.
4) How to check:
call apoc.config.list
You should see:
apoc.import.file.enabled true
I originally added
apoc.import.file.enabled=true
to the end of the neo4j.conf file and "HTTP logging configuration" section.
I moved the comment to the "Server configuration" section and now it works.
I know this has been asked many times before. But I am getting a:
The mbstring extension is missing. Please check your PHP configuration.
First off I am using WanmpServer3.0.0 64 on a Win7 64 VM.
-I tried editing the php.ini file to give an absolute path to no avail
-made sure that the extension=phpmbstring.dll is uncommented
Another problem is that i noticed that whenever i load a php page it has fatal errors for my mysql commands.
When I use the wampmanager from the tray to open the php.ini file instead of through windows explorer I get:
Cannot find the C:\wamp64\bin\apache\apache2.4.17\bin\php.ini file. Do you want to create a new file?
So now I'm thinking something has gone drastically wrong and would like to uninstall/reinstall Wamp. I attempt to use the mysql console to save my databases before deleting the wamp directory. However when I run a mysqldump -all-databases > all_database.sql it just drops down to an empty line and nothing happens.
mysql console screenshot
If I browse around in the C:\wamp64 directory i find the "data" directory within \bin\mysql where it seems all of my databases reside but not in readable form.
Is there anyway to save my databases??
BTW: This whole setup was working fine previously, so I'm not sure what caused the crash and burn.
Was able to figure it out.
I opened the php.ini file from the PHP bin folder and copied all of the contents into a new php.ini file to reside in the apache bin file.
Now everything works again.
I'm not sure this is how wampserver is supposed to work or what changed to start the problem but it's pseudo-resolved now.
I'm using Ruby version: 2.0. The function Resolv.getaddress(fqdn) is returning following error when used in rails application.
Parameters: {"fqdn"=>"1kzdm.scalsoln.in"}
Completed 500 Internal Server Error in 64ms
Resolv::ResolvError (no address for 1kzdm.scalsoln.in):
I'm have entry for this host in /etc/hosts and is resolvable using ping.
How can I make the Resolv.getaddress() function to read entries in /etc/hosts file?
It should just work like you expect - and it does on my machine.
Resolve::Hosts doesn't read in /etc/hosts on every resolution, though. It reads the file on first resolution and it is then cached for the subsequent calls. Perhaps you simply need to restart your server process to force a reload of the /etc/hosts file?
To work around the caching (ie. always resolve using non-cached data) you can create a new Resolv instance every time you want to look something up:
Resolv.new.getaddress("1kzdm.scalsoln.in")
(note the new in there).
I am using a bat file on a Windows 2000 SP4 server to copy database files while the database is shut down. Once the bat file hits the xcopy command, it does the copy, but never returns to the bat file to continue with the other commands (start up the database, etc). I should mention that the xcopy takes several hours. Is there some sort of time out or time max with bat files? Is this normal? If so, is there any way around this?
Batch files don't timeout. It sounds like you might be running into a prompt from XCOPY, like an "Are you sure" prompt.
Make sure you've added the necessary command-line switches to XCOPY to make it silent.
The ones I'm aware of are:
-Y to suppress prompts about overwriting files
-C continue even if errors occur
Also, make sure that you are running the XCOPY.EXE app, and not finding an XCOPY.BAT file somewhere on your path. (calling a batch file from a batch file prevent returning, unless you use the CALL command)
And, be sure you are not overwriting the batch file itself during the XCOPY.
Presumably everything looks OK in your backup.log file?
It looks like you are redirecting STDOUT to your log file, but not STDERR - would suggest adding 2>&1 to the end of the command line to ensure you're not missing any error information from the log.
There's no timeout that I'm aware of on .bat or .cmd files. However, there may be on the process that's launching it? How are you launching it?