Problem with new Install

We’ve used a self-hosted version of Invoice Ninja for about a year on a shared server where it ran fine. Now that server’s PHP version is outdated so I’m moving to a new server on Digital Ocean. However I keep getting a 500 error after extracting the Zip, adjusting permissions and creating the database. I’ve checked permissions over and over and they’re all correct. I have several other PHP stacks and wordpress stacks on this server and Invoice Ninja is being installed on it’s own PHP stack. The server uses nginx and mysql. There is nothing unusual about it at all. I’ve installed at least 10 other apps on it, from wordpress, to resourcespace and EspoCRM without any issue. Any guesses as to what’s going on and why I can’t even get to the first install screen? I’ve installed Invoice Ninja at least 3 other times on servers without too many issues.

Thanks
Chris Blair

Ok I got past the permissions issue but now I’m having trouble getting my old database imported from vers 2.5.04 to the latest version. What is the recommended method? I’m exporting from PHPMyAdmin (have tried a bazillion ways, from simple to all sorts of other custom selections), but the import into the new install errors out every time. I’ve tried importing the database first, then going through the new install, but I end up with “Whoops, something went wrong.” If I run /update to update the schema I get an error:

SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name ‘logo’ (SQL: alter table accounts add logo varchar(255) null, add logo_width int unsigned not null, add logo_height int unsigned not null, add logo_size int unsigned not null, add invoice_embed_documents tinyint(1) not null default ‘0’, add document_email_attachment tinyint(1) not null default ‘0’)

So obviously the database is borked from the import. Getting frustrated. Any tips?

Chris Blair

It looks like the migrations to update the database to the latest version are failing.

If you want to email a copy of your database to contact@invoiceninja.com we can try to help debug the problem.

Here’s the original database exported from PHPMyAdmin using “Quick.”

[link removed]

Thanks, I’ll let you know what I find.

I think I see the problem, it looks like the foreign keys are failing because the storage engine is MyISAM.

Here’s one method to convert the tables to InnodDB: http://stackoverflow.com/a/5319446

We’ll include a fix for this in our next release.

Hmm… maybe not, still looking into it.

Ok…thanks. Much appreciated. Good to know that maybe it’s NOT just me :))!! = I’d be happy to give you access to both servers if that helps. The = original one is an old shared MediaTemple server. The second is a newer = Digital Ocean server administered by Cloudways. Unfortunately I don’t = have root access on it but I do have SSH access to mysql if that helps.

I think I have a solution, here are the steps:

  1. Import the backup into a clean database
  2. Run the following SQL queries and then load /update (or /public/update)
SET sql_mode = 'ALLOW_INVALID_DATES';
ALTER TABLE account_gateway_tokens engine=InnoDB;              
ALTER TABLE account_gateways engine=InnoDB;                    
ALTER TABLE account_tokens engine=InnoDB;                      
ALTER TABLE accounts engine=InnoDB;                            
ALTER TABLE activities engine=InnoDB;                          
ALTER TABLE affiliates engine=InnoDB;                          
ALTER TABLE bank_accounts engine=InnoDB;                       
ALTER TABLE bank_subaccounts engine=InnoDB;                    
ALTER TABLE banks engine=InnoDB;                               
ALTER TABLE clients engine=InnoDB;                             
ALTER TABLE contacts engine=InnoDB;                            
ALTER TABLE countries engine=InnoDB;                           
ALTER TABLE credits engine=InnoDB;                             
ALTER TABLE currencies engine=InnoDB;                          
ALTER TABLE date_formats engine=InnoDB;                        
ALTER TABLE datetime_formats engine=InnoDB;                    
ALTER TABLE expenses engine=InnoDB;                            
ALTER TABLE fonts engine=InnoDB;                               
ALTER TABLE frequencies engine=InnoDB;                         
ALTER TABLE gateways engine=InnoDB;                            
ALTER TABLE industries engine=InnoDB;                          
ALTER TABLE invitations engine=InnoDB;                         
ALTER TABLE invoice_designs engine=InnoDB;                     
ALTER TABLE invoice_items engine=InnoDB;                       
ALTER TABLE invoice_statuses engine=InnoDB;                    
ALTER TABLE invoices engine=InnoDB;                            
ALTER TABLE languages engine=InnoDB;                           
ALTER TABLE licenses engine=InnoDB;                            
ALTER TABLE migrations engine=InnoDB;                          
ALTER TABLE password_resets engine=InnoDB;                     
ALTER TABLE payment_libraries engine=InnoDB;                   
ALTER TABLE payment_terms engine=InnoDB;                       
ALTER TABLE payment_types engine=InnoDB;                       
ALTER TABLE payments engine=InnoDB;                            
ALTER TABLE products engine=InnoDB;                            
ALTER TABLE sizes engine=InnoDB;                               
ALTER TABLE subscriptions engine=InnoDB;                       
ALTER TABLE tasks engine=InnoDB;                               
ALTER TABLE tax_rates engine=InnoDB;                           
ALTER TABLE themes engine=InnoDB;                              
ALTER TABLE timezones engine=InnoDB;                           
ALTER TABLE user_accounts engine=InnoDB;                       
ALTER TABLE users engine=InnoDB;                               
ALTER TABLE vendor_contacts engine=InnoDB;                     
ALTER TABLE vendors engine=InnoDB;                 

Will give that a go and report back.

boom shakalaka…worked! Thanks so much.

Great to hear, thanks for letting us know!

Hello Chris,

I too am trying to install Invoice Ninja via Cloudways but on Linode. Any advice on the file install? Did you use the download option or GitHub? Thanks!

If you aren’t a developer then we recommend using the self host zip from https://www.invoiceninja.org

Yeah I used the zip file to install and following Hillel’s tip worked for me.

Chris Blair