Custom PHP

software development

#1

I’ve got a PHP web utility I’d like to use, but I’m getting a 500 internal server error saying it’s timing out. The developer of the utility told me I needed to extend the time in the PHP file, which I think I’ve done as follows:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 100000 ; Maximum execution time of each script, in seconds
memory_limit = 1000M ; Maximum amount of memory a script may consume (8MB)

Unfortunately, I still get a 500 internal server error. Further, here is data from my error log:

[Sat Jul 18 13:45:34 2009] [error] [client 72.147.205.247] Premature end of script headers: db_update.php, referer: http://files.mblsim.com/ootpsqlou/admin.php
[Sat Jul 18 13:45:34 2009] [error] [client 72.147.205.247] File does not exist: /home/mbl_file_upload/files.mblsim.com/internal_error.html, referer: http://files.mblsim.com/ootpsqlou/admin.php
[Sat Jul 18 13:46:48 2009] [error] [client 72.147.205.247] Premature end of script headers: sql_file_load.php, referer: http://files.mblsim.com/ootpsqlou/sql_file_load.php
[Sat Jul 18 13:46:48 2009] [error] [client 72.147.205.247] File does not exist: /home/mbl_file_upload/files.mblsim.com/internal_error.html, referer: http://files.mblsim.com/ootpsqlou/sql_file_load.php

I really need this to work, but I am in over my head. Can anyone help me understand what the problem is? I know of other non-DreamHost users using this utility without problems; however, DH offers me no help. It’s the same song with these people, and if I wasn’t paid up through 2011, I’d walk away. I’ve already reported them to the BBB, but they just don’t show a willingness to help me in any way, which is disappointing.


#2

Why should they help you? They offer hosting, not development and support for random scripts.

Are you uploading an SQL-file? Could it be to big, and could it be split in smaller parts?


#3

The problem appears to be with importing a 13 megabyte SQL file into a database. BTW I can tell because you dumped everything into a web directory so thats another issue.

You appear to be on a shared server. I’m sorry but shared servers by necessity have limits on how much time and how much memory can be used. That’s simply because you are sharing. As a result you’re not going to get enough of the machines capacity long enough to run a gazillion database queries at once - their other other customers that also need capacity. Now with DreamHostPS you can get a virtual private server and pay for up the capacity you need. This appears to be a one time issue though so I don’t think you have to go that far yet.

I see two solutions - split the SQL files up, and don’t try importing them all at once. Or install MySQL on your computer at home and import them directly to the MySQL database without tying up the web server.

If you want to try splitting them up I can help you with that. You can download MySQL here: http://dev.mysql.com/downloads/

Customer since 2000 :cool: openvein.org


#4

[quote];;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 100000 ; Maximum execution time of each script, in seconds
memory_limit = 1000M ; Maximum amount of memory a script may consume (8MB)[/quote]
Atropos7 has given you good and accurate advice on this. Irrespective of how you customize the PHP environment by modifying those settings in php.ini, you will not be able to use that amount of resources on a shared hosting plan. That level of resource usage will require a VPS (DreamHost PS) or Dedicated server with adequate resources reserved for your own private use.

What kind of help are you expecting with this problem? We can’t help you run that on a shared server any more effectively than we can help you stuff an elephant into a mini-cooper. That said, if you really want to walk away, reply to me via PM with your WebID, or a domain name you are hosting at DreamHost, and I will arrange a pro-rated refund of your unused hosting time. Life is short, and there is no reason to hang around unhappy - I’ll help you “walk away” without financial penalty if that is what you think will make you happy. :wink:

Well, it may be disappointing, but I don’t think the BBB is a particularly useful resource for resolving web application programming issues (or for stuffing elephants into mini-coopers)! :wink:

–rlparker
–DreamHost Tech Support


#5

I also see a third alternative, which would be to use the shell to import the database via the command line as described here:

http://wiki.dreamhost.com/Migrate_MySQL#Importing_Through_the_Shell

–rlparker
–DreamHost Tech Support


#6

Can’t believe I overlooked that. Also I wrote a small bash script since it looks like he has about 50 SQL files to import:


[code]#!/bin/bash

USERNAME="username"
PASSWORD="password"
HOSTNAME="mysql.yourdomain"
DATABASE=“database”

TIMEFORMAT=$’, elapsed time %2lR’
for SQLFILE in ./*.sql
do
echo -n "LOADING: $SQLFILE "
time mysql -h $HOSTNAME -u $USERNAME -p$PASSWORD $DATABASE < $SQLFILE
done

exit 0[/code]---------------------------

Instructions (shell access):

  1. Update the variables at the beginning
  2. Save in the directory with SQL files as import.sh
  3. Change working directory to same directory if haven’t done so
  4. chmod 755 import.sh
  5. ./import.sh

The output should look like this:

LOADING: ./players_game_batting.mysql.sql , elapsed time 1m39.91s LOADING: ./team_history_batting_stats.mysql.sql , elapsed time 0m1.25s ...
Customer since 2000 :cool: openvein.org


#7

Nice, indeed! One of the greatest things about these forums is when people go the extra mile to help others like this! :slight_smile:

This kind of help is great, and can often fill in the gaps when users need help that is outside the scope of the support that we provide - thanks for doing that!

–rlparker
–DreamHost Tech Support


#8

I’ve tried the bash file and will report when I see if it works. I’m very much an amateur when it comes to this stuff; I’m simply using a utility created by someone else.

As for my displeasure with DH, frustration boiled over. I don’t expect them to resolve issues like this, but when you pay for a site and something doesn’t work, getting an email reply of “We can’t help, sorry” doesn’t exactly help!

Anyways, I am curious as to what this bash does. Does it simply import any .sql file in that directory to the database?


#9

I understand that loading a 13 MB file has problems, but I am getting the error on a 4.1 MB file as well. Help me understand why, please.


#10

Your web server is just that - a web server. DreamHost expects it to be doing work related to making a web site work. A web server gets a request from a browser and sends a response back as quick as possible. As a result that kind of work shouldn’t take a long time. Now the problem is that if it does take a long time, and the server gets more requests, the machine reaches capacity and no more requests can be handled. And then the 20 - 30 customers DreamHost has using that machine have their web sites go down. Bummer!

Now I’m sure you don’t want to make 30 customers unhappy anymore than DreamHost does, so they have a process killer that checks how long a web server is handling a request, and if it takes to long, poof. Besides that, theres only so much memory to go around as well, and you can’t do work with out memory. PHP alone takes up 100 megabytes of RAM.

Anyways, you’re utility in this regard is not doing web site work. It is reading dozens of text files and shoveling that data off to a database server. And thats a lot of data and thus a lot of time. But wait, its being run by the web server, so its subject to the process killer. Ooops.

So the obvious solution is to avoid running it under the web server and its process killer. So you can login to a shell account or use your own computer. Splitting the workload into small batches might also work if you absolutely must run it under the web server, but thats complicated to setup.

Customer since 2000 :cool: openvein.org


#11

The only problems here is that using the shell didn’t work and doing anything else means I’m not using the utility, which is a one button deal making life very easy. I’d like to figure this one out, but it appears Dreamhost and I are incompatible.


#12

[quote]I’ve tried the bash file and will report when I see if it works. I’m very much an amateur when it comes to this stuff; I’m simply using a utility created by someone else.

As for my displeasure with DH, frustration boiled over. I don’t expect them to resolve issues like this, but when you pay for a site and something doesn’t work, getting an email reply of “We can’t help, sorry” doesn’t exactly help![/quote]
Did you get to the point and ask DreamHost support to help you import dozens of SQL files? I would expect them to be more helpful if you had. After all that was the real problem, and not trying to get the web server to do something its not meant to. There’s more than one way to skin a cat, and the advice you got from a third-party wasn’t the best for your situation.

Also in case you don’t want to wait for support to get back to you, try searching the Wiki. For a lot of things somebody has probably done it before and written it down.

Yes. Instead of having to run the command 50 times, it does it automatically. It also times how long each one took. The ones that take more than 30 seconds - yeah those are the ones that should not have been attempted by the web server, much less all 50 in one go.

Customer since 2000 :cool: openvein.org