- Bug #64870: mysqlnd: can't connect to updated MySQL server with oldpassword Off: Submitted: 2013-05-17 16:44 UTC: Modified: 2013-10-15 11:54 UTC.
- 基于这个原因,MySQL Native驱动mysqlnd,作为libmysql的一个 针对PHP应用的修改版本被开发。 mysql,mysqli以及PDO Mysql驱动都可以各自配置使用 libmysql或者mysqlnd。mysqlnd作为一个专门设计 用于PHP系统的库,它在内存和速度上都比libmysql有很大提升。非常希望你去尝试这些.
Server Requirements
The mysqlndms replication and load balancing plugin can be used with PHP MySQL extensions (ext/mysql, ext/mysqli, ext/pdomysql) if they are compiled to use mysqlnd. The plugin inspects queries and does read-write splitting. Read-only queries are sent to MySQL replication slave servers while all other queries are redirected to the MySQL.
Invoice Ninja has a few system requirements. Built on top of Laravel it requires a PHP and MySQL server at a minimum with the following version and extensions installed.
You need to setup this version completely from scratch. Do not attempt to overwrite your old version of Invoice Ninja (4.x.x) with this version as the two codebases are completely different.
- PHP >= 7.3.x
- bcmath extension
- ctype extension
- fileinfo extension
- gd extension
- json extension
- mbstring extension
- openssl extension
- PDO extension
- tokenizer extension
- xml extension
- curl extension
- zip extension
- gmp extension
- mysqli extension
- MySQL / MariaDB Server
On ubuntu this should be as simple as running:
Installing Invoice Ninja
Installing on CentOS 8 / Ubuntu 20.04 (Recommended)
Technically computers has a very helpful step by step guide on how to install Invoice Ninja v5 from scratch onto CentOS, you can access the guide here. If Ubuntu is more your flavour you can follow his awesome guide here
Installing on Arch
If Arch Linux is more your flavor, brackenhill-mob from our forum has a very thorough step by step installation guide here Crusader kings 3 is there any deal.
Download pre built zip. (Advanced)
A prebuilt zip can be downloaded from our GitHub release page here. You will need to download the package which is appended with -release, download the file named invoiceninja.zip.
Unzip this file into the virtual host directory you have created.
Ensure the file permission have been set to the web server user. For example in Ubuntu this is www-data if you have configured a virtual host with a root directory of
/var/www/html
you would set the ownership like this.Web server configuration
A sample NGINX configuration is provided below, it assumes you have PHP 7.4 installed with the PHP FPM extension installed
Performance hint!Enable gzip in your webserver configuration, this will dramatically improve the loading time of the application! Please see the above nginx configuration for a sample of how to load the components of the application with gzip.
Database server configuration
Create a database on your MySQL compatible server and add a user that has full access to the database, database configuration is out of the scope of this article, more information can be found here
Cron configuration
Ensure you set the scheduler under the web server user i.e.
sudo -u www-data crontab -e
Invoice Ninja relies heavily on the Laravel Scheduler, for this to operate it requires that a cron job to be configured, edit your crontab and enter the following record.
If you are using shared hosting, then you will need to add an additional parameter to the cron command which looks like this:
Installation from git (Advanced)
For power users installing the app from Github can be done with the following steps
Final setup steps
Once you have configured your virtual host, create a database and point your browser to http://your.domain.com/setup - the setup process will check a number of system settings such as PDF generation, database and mail settings and also allow you to configure the first account on the system, click Submit and the app will setup your application and redirect you to the login page
Cron configuration
Invoice Ninja relies heavily on the Laravel Scheduler, for this to operate it requires that a cron job to be configured, edit your crontab and enter the following record
Ensure you set the scheduler under the web server user i.e.
sudo -u www-data crontab -e
Some Webservers require the Cronjob to end with
> /dev/null 2>&1
instead of >> /dev/null 2>&1
for it to work.Also check if your Webserver Cronjob needs to be set with /private_html/
instead of /public_html/
within the path.And sometimes it's enough to put php
instead of /opt/alt/php73/usr/bin/php
in the cronjob scheduler command to execute.If you still encounter errors, it may be helpful to temporarily remove
>> /dev/null 2>&1
from the cron, this should output the cron to the cron.log
If you are having troubles with your crons, have a look at the troubleshooting section here
If you would like to improve the performance of your Invoice Ninja installation, then turning on the queue system will dramatically improve the performance of the application.
If you have root access to your system, then simply follow the Laravel guide to configure the supervisor service to start and restart your queue.
You will then need to update the QUEUE_CONNECTION variable in the .env file as follows:
Apt-get Install Mysqlnd
If you are on shared hosting, it is possible to get the queues working by defining a new cron with the following configuration:
This cron will start a queue worker every 5 minutes and run any jobs that are in the queue and then gracefully terminate itself. This means any emails / notification may be queued for a small period of time prior to executing. If this amount of delay is acceptable, it is a great way to get queue's working on shared hosting.
Shared Hosting
Server Requirements
We have tested Invoice Ninja v5 on shared hosting and can confirm that it does work. Softaculous has a one click installer which makes the entire setup process simple, however if you do not have Softaculous available it may still be possible to instlal Invoice Ninja. There are several checks you will need to do prior to confirming whether your Shared Host has the correctly enabled modules. Invoice Ninja relies on:
- proc_open
- exec
- open_basedir
- fpassthru
Without these modules, you will not be able to run Invoice Ninja. We do include some preflight checks of these modules in the Setup workflow, but it is best to check with your host that they support these modules. Some hosts choose to disable these modules as they classify them as security risks.
Database configuration
Create a MySQL compatible database in your shared host control panel along with a database user, record the database name, username and password as you'll need this later. Ensure your database user has full access to the database you've just created.
Upload release asset
Download the latest release from our Releases page. Note, you'll want to find the latest release which will contain 3 files, the one you need will be annotated as invoiceninja.zip.
Upload this file to your shared host, typically if your webhost uses the industry standard cPanel, you'll want to upload the invoiceninja.zip file to the public_html directory. Once the upload has completed, using the file manager unzip the file.
Run setup
Mysqli Vs Mysqlnd
Navigate to https://your.url.com/setup and fill in the form. The setup process will perform some pre flight checks and then attempt run the setup. If it has been successful you will be navigated to the Admin portal. If the setup fails for some reason, you'll be returned to the Setup screen with an error message, there may be additional errors reported in storage/logs/laravel.log that will provide more information where the setup has failed.
If you see a 404 webserver error and use sub.domain.com make sure to point the path for the subdomain towards the
/public
folder from the extracted invoiceninja.zip file, for example: /domains/domain.com/public_html/invoices2/public/
Add the cron job
Add the Laravel scheduler cron job, be sure to include the full path, for a cPanel host it should look like this:
Installing Invoice Ninja (Docker)
If you prefer to use Docker, we have a dedicated repository with detailed instructions on how to get started HERE
Currency Conversion
Invoice Ninja supports Open Exchange for currency conversion.Open Exchange currently provides a free tier which is suitable for daily updates of the exchange rates.Simply insert a Open Exchange API key into your .env file to enable exchange rate updates:
Make sure to update your cache afterwards: