Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diferent port for database adapter #1008

Merged
merged 5 commits into from Jul 28, 2017
Merged

Diferent port for database adapter #1008

merged 5 commits into from Jul 28, 2017

Conversation

horaciod
Copy link
Contributor

@horaciod horaciod commented Jul 19, 2017

need a different port for my database (postgresql listening in port 5434)

TODO:

  • Document how to specify the port in config.ini (right now, implemented as part of the database connection string)
  • Test with MySQL

i need a different port for my database (postgresql listening in port 5434) 
in config.ini 
[Database] 
database          = pgsql://postgres:pass@localhost/databasepostgres
schema = vufind
port = 5434
I think that is working for mysql too.
@demiankatz
Copy link
Member

demiankatz commented Jul 19, 2017

Thanks for sharing this!

Did you consider specifying the port as part of the connection string? e.g. pgsql://postgres:pass@localhost:5434/databasepostgres? If that doesn't work with the existing code, a bit of extra processing of the $host variable could probably make it work. I don't really object to adding a 'port' setting, but including the port in the connection string might be more consistent with the rest of our approach to database configuration. What do you think?

@horaciod
Copy link
Contributor Author

Ok, I will work in that approach.

@demiankatz
Copy link
Member

Thank you very much! I'm happy to help if you need anything.

@demiankatz
Copy link
Member

@horaciod, I had a few moments free, so I pushed up a proposed alternate implementation that makes use of the connection string instead of a separate setting. Do you mind trying this and letting me know if it works for you? It appears upon initial testing that the 'port' setting does not work correctly with the mysqli adapter. Further work may be needed to get this working correctly with all platforms. I am adding a TODO list to the PR comment so we don't forget about this issue (or the need to add documentation in config.ini once we settle on an approach).

@demiankatz
Copy link
Member

@horaciod, I was finally able to test this successfully with MySQL; I discovered that if you connect to MySQL on localhost, PHP uses sockets and ignores the port number.... however, by connecting to 127.0.0.1 instead, I was able to confirm that the port setting is being respected.

@demiankatz
Copy link
Member

At this point, I'm pretty comfortable that this works -- merging now. Thanks again!

@demiankatz demiankatz merged commit 7756037 into vufind-org:master Jul 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants