XF 2.1 Error when trying to create an addon

JohnLogar

Active member
Hi,
I just moved from the Linux to Mac OS. I installed the MAMP 5.7 to get a local server setup. But I facing an issue when I create addon by the following command

Code:
php cmd.php xf-addon:create

Once I run the command the following error is showing

Code:
An exception occurred: [XF\Db\Exception] No such file or directory in src/XF/Db/Mysqli/Adapter.php on line 165
#0 src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array)
#1 src/XF/Db/AbstractAdapter.php(60): XF\Db\Mysqli\Adapter->getConnection()
#2 src/XF/Db/Mysqli/Adapter.php(113): XF\Db\AbstractAdapter->connect()
#3 src/XF/Db/AbstractAdapter.php(516): XF\Db\Mysqli\Adapter->escapeString('addOnsComposer')
#4 src/XF/Db/AbstractAdapter.php(494): XF\Db\AbstractAdapter->quote('addOnsComposer')
#5 src/XF/DataRegistry.php(138): XF\Db\AbstractAdapter->quote(Array)
#6 src/XF/DataRegistry.php(83): XF\DataRegistry->readFromDb(Array, Array)

anyone would like to help me with it.

Thanks
 
If your src/config.php file contains:
PHP:
$config['db']['host'] = 'localhost';

Then change it to the following which will make it use TCP/IP rather than socket connection:
PHP:
$config['db']['host'] = '127.0.0.1';
 
Could you please help me to switch the PHP version in MAMP. I need PHP 5.6 which is not available in Preferences. It's only allow to change the latest 2 version 7.3 and 7.4.
 
Well I assume that MAMP only includes those versions. I'm not familiar enough with it to know how to add additional versions.

Is there any reason you can't use 7.2, 7.3 or 7.4?
 
Ok. I'd recommend working towards PHP 7.0 as a minimum. Significantly XF 2.2 drops support for PHP 5.x entirely so at some point you'll need to be working with PHP 7 for XF development.

As for the MAMP issue I don't know, sorry.

This is the process I follow to set up my dev environment:
It sets up various PHP versions from 5.6 up to the latest using Homebrew and includes a simple way of switching versions.
 
I understand your recommendation and will definitely work on it to make it compatible with the latest PHP version.

Meanwhile, I think the above link will also work with Mojave 10.14.
 
Yeah pretty certain it will. I've run various iterations of that guide over several years. It hasn't changed much in that time.
 
If your src/config.php file contains:
PHP:
$config['db']['host'] = 'localhost';

Then change it to the following which will make it use TCP/IP rather than socket connection:
PHP:
$config['db']['host'] = '127.0.0.1';
not worked for me. Still getting the same error.
 
not worked for me. Still getting the same error.
Same thing happened here on my mac.

Code:
An exception occurred: [XF\Db\Exception] The server requested authentication method unknown to the client in src/XF/Db/Mysqli/Adapter.php on line 165
#0 src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array)
#1 src/XF/Db/AbstractAdapter.php(60): XF\Db\Mysqli\Adapter->getConnection()
#2 src/XF/Db/Mysqli/Adapter.php(113): XF\Db\AbstractAdapter->connect()
#3 src/XF/Db/AbstractAdapter.php(516): XF\Db\Mysqli\Adapter->escapeString('addOnsComposer')
#4 src/XF/Db/AbstractAdapter.php(494): XF\Db\AbstractAdapter->quote('addOnsComposer')
#5 src/XF/DataRegistry.php(138): XF\Db\AbstractAdapter->quote(Array)
#6 src/XF/DataRegistry.php(83): XF\DataRegistry->readFromDb(Array, Array)
#7 src/XF/DataRegistry.php(226): XF\DataRegistry->get(Array)
#8 src/XF/App.php(1779): XF\DataRegistry->offsetGet('addOnsComposer')
#9 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#10 src/XF/App.php(2306): XF\Container->offsetGet('addon.composer')
#11 src/XF/App.php(1878): XF\App->setupAddOnComposerAutoload()
#12 src/XF/Cli/App.php(25): XF\App->setup()
#13 src/XF.php(461): XF\Cli\App->setup(Array)
#14 src/XF/Cli/Runner.php(52): XF::setupApp('XF\\Cli\\App')
#15 cmd.php(15): XF\Cli\Runner->run()
#16 {main}
 
We generally recommend installing via homebrew for macOS users.

Worth noting @ShikiSuen the error you got was different to any error mentioned in this thread so any solutions here would have been unlikely to help.
 
Back
Top Bottom