I have configure Oci & PHP and runs correctly. When I run php file for connect to Oracle using php works fine.
When I run php app/console doctrine:mapping:import, the entities are discovered and the entity file exists with the table's fields, but when I try to browser to http://localhost/app_dev.php shows me:
DEBUG - oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and LD_LIBRARY_PATH are set and point to the right directories DEBUG - oci_connect(): Error while trying to retrieve text for error ORA-01804 CRITICAL - Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occured in driver: " at /var/www/html/proyecto3/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php line 76
My configuration files are:
config.yml
> doctrine:
> dbal:
> driver: oci8
> host: "%database_host%"
> port: "%database_port%"
> dbname: "%database_name%"
> user: "%database_user%"
> password: "%database_password%"
> charset: UTF8
parameters.yml
> parameters:
> database_host: 192.168.59.148
> database_port: 1521
> database_name: BRULO001
> database_user: scott
> database_password: scott
> mailer_transport: smtp
> mailer_host: 127.0.0.1
> mailer_user: null
> mailer_password: null
I try to set vars ORACLE_HOME and LD_LIBRARY_PATH inside /etc/sysconfig/httpd and httpd.conf files, but not works
Related
Hi I have a Oracle database installed locally on my laptop. I'd like to connect to it via Codeigniter 4. Since version 4.2.0 it is able to do so.
https://codeigniter4.github.io/CodeIgniter4/changelogs/v4.2.0.html
All my database credentials are in the .env file, but I'm unable to establish connection. I'm new to Oracle.
I can connect to my database via Oracle SQL Developer.
The data I use for the connection:
host: localhost
port: 1521
user: system
password: MYPASSWORD
service name: orcl
How can I use that in my .env file?
This is what I have so far:
database.default.hostname = localhost
database.default.database =
database.default.username = system
database.default.password = MYPASSWORD
database.default.DBDriver = oci8
database.default.DBPrefix =
database.default.port = 1521
I get this error:
Unable to connect to the database.
Main connection [oci8]: oci_connect(): ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
(.env file)
Try using:
database.default.hostname = '127.0.0.1:1521/orcl'
Where:
'127.0.0.1:1521/orcl', // hostname:db_port/service_name
I have following stage in gitlab yml file.
integration-tests:
image: mydocker-hub-id/mvn-intergration-tests-image:latest
stage: test
services:
- postgres
script:
- export PGPASSWORD=$POSTGRES_PASSWORD
- psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"
- cd source_code
- pg_isready
- mvn verify -P test-ci -DskipUTs=true
When job is executed for command pg_isready I have response 5432 no response.
When tests are executed from each intergration test I have error:
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Image used in this stage is built based on postgres image which has additionally installed maven and java 11.
What could be the issue that spring application cannot connect with postgres server. Command postgres --version displays proper version. Also command
"psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"
returns the OK result.
Spring db connection in app.properties is following:
spring.datasource.url=jdbc:postgresql://localhost:5432/test
I found in gitlab documentation details about postgres service configuration
https://docs.gitlab.com/ee/ci/services/postgres.html?fbclid=IwAR1eDlOQ4ACn6zqw1auIetB07JRcCGi1Pjl-hpfGBM45ujvkImm6fHSSbgg
The db url should contain the name of host postgres instead of localhost.
I found gitlab-runner is running the postgresql docker image as postgres and this is working changing jdbc:postgresql://localhost:5432/dbname into jdbc:postgresql://postgres:5432/dbname.
I have a laravel app on nginx with postresql
php artisan migrate
throws error:
In Connection.php line 671:
SQLSTATE[08006] [7] received invalid response to SSL negotiation: b (SQL: select * from information_schema.tables where table_schema = publ
ic and table_name = migrations and table_type = 'BASE TABLE')
In Connector.php line 70:
SQLSTATE[08006] [7] received invalid response to SSL negotiation: b
FILES:
.env
...
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=secretdbname
DB_USERNAME=secretusername
DB_PASSWORD=secretpassword
...
postresql.conf
...
port = 5432
...
in php.ini enabled:
pgsql
pdo_pgsql
mbstring
php -m
...
mbstring
openssl
PDO
pdo_mysql
pdo_pgsql
pgsql
...
Appropriate db exists, user exists and has got all the privileges.
Postgres service is active.
DB and app are located on the same server.
What I have tried:
setting up a different port in both .env and postgres.conf
tested with a different db, user and password
restarted postresql
in tinker DB::connection()->getPdo(); throws the same error
in DB_HOST tried 127.0.0.1. instead of localhost
in config/database.php i tried setting 'sslmode' to 'disable'
I have SSL certificate with certbot.
I would appreciate some hint on how to solve the above error.
Indeed, following Alex running
php artisan config:cache
helped, as it thrown a slightly different error which pointed me to the actual solution
SOLUTION:
postgresql.conf file has got this line:
listen_addresses = 'localhost'
commented by default, thus the solution is simply to uncomment it (as I mentioned in my original post, both DB and app are on the same server).
Hope it will save sb's time for the future.
I got the same error today with the Laravel 9.
The solution was to make sure the Postgress DB_Port inside .env is pointing to 5432.
Hope it will help others.
I am deploying a new application to Google App Engine Flex environment. The app is powered by Laravel.
I am able to connect to the database on my local machine, however, I am unable to connect to the database once I deploy my application.
What information do I need to include in the app.yaml file to connect to the database? Do I require any other information in a different file?
"message": "SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host \"localhost\" (::1) and accepting\n\tTCP/IP connections on port 5432?\ncould not connect to server: Connection refused\n\tIs the server running on host \"localhost\" (127.0.0.1) and accepting\n\tTCP/IP connections on port 5432? (SQL: select * from \"users\" where \"email\" = mitchell#efficialtec.com and \"users\".\"deleted_at\" is null limit 1)",
This is the contents of my .ENV file which allows me to connect locally
APP_ENV=development
APP_KEY=base64:B0G3Yr82fWO7xw8LrvcOC19DGUAEd32loJlPHCfP2sg=
APP_DEBUG=true
LOG_CHANNEL=stack
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_POST=5432
DB_DATABASE=DATABASE
DB_USERNAME=USERNAME
DB_PASSWORD=PASSWORD
DB_SOCKET: "/cloudsql/CONNECTION_NAME"
This is the contents of my app.yaml file:
env: flex # let app engine know we use flexible environment
service: SERVICENAME
automatic_scaling:
min_num_instances: 1
max_num_instances: 2
cpu_utilization:
target_utilization: 0.8
runtime_config:
document_root: public
skip_files:
- .env #we want to skip this to make sure we don’t mess stuff up on the server
env_variables:
# Put production environment variables here.
APP_ENV: development
APP_DEBUG : true # or false
APP_KEY: base64:B0G3Yr82fWO7xw8LrvcOC19DGUAEd32loJlPHCfP2sg=
APP_LOG: daily
APP_TIMEZONE: UTC #your timezone of choice
# Replace USER, PASSWORD, DATABASE, and CONNECTION_NAME with the
# values obtained when configuring your Cloud SQL instance.
POSTGRES_USER: USERNAME
POSTGRES_PASSWORD: PASSWORD
POSTGRES_DSN: pgsql:dbname=bnsw;host=/cloudsql/CONNECTION_NAME"
DB_HOST: localhost
DB_DATABASE: DATABASE
DB_USERNAME: USERNAME
DB_PASSWORD: PASSWORD
DB_SOCKET: "/cloudsql/CONNECTION_NAME"
beta_settings:
cloud_sql_instances: "CONNECTION_NAME"
Any help on this would be greatly appreciated, I have been looking on Google for almost a week with no answers yet!
By default, Laravel does not have DB_SOCKET under pgsql connection.
Thus, in order to connect to cloud SQL connection from app engine, you env show look like :
DB_CONNECTION=pgsql
DB_HOST=/cloudsql/CONNECTION_NAME
DB_DATABASE=DATABASE
DB_USERNAME=USERNAME
DB_PASSWORD=PASSWORD
Also please, don't include DB_PORT in the database env variables.
I can't connect to mysqlfabric on port 32275.
I am connecting on port 3306 to database so all the grants are in place . On port 32275 I get a message
ERROR 1044 (42000): [Fabric] Access denied
for user and in log I can see
[INFO] 1441810699.948011 - MySQL-RPC-Session-4 - User 'john'
denied access which suggests permissions issue.
I can log in to database if I use
mysql -u fabric -p -h localhost -P 32275
but if I use
mysql -u fabric -p -h host-ip-address -P 32275
I get above error. I can see in netstat that server is listening on that port.
What am I doing wrong ?
There are a couple of things to check in the fabric config.
Firstly try disabling RPC authenication until you have it up and running.
[protocol.xmlrpc]
disable_authentication = no
Also check your storage section and test you can connect using these settings.
[storage]
address = 192.168.0.1:3306
user = fabric_store
password = secret
database = mysql_fabric
auth_plugin = mysql_native_password
mysql -u fabric -psecret -h 192.168.0.1 -P 3306 fabric_store