I'm using lighttpd and pfp-fpm.
All work correctly, but if I call a mysql_connect() on my php scripts I get an empty page.
Like a "denied operation".
This is my php-fpm.conf pool
[example.com]
listen = 127.0.0.1:9001
listen.backlog = -1
user = example.com
group = example.com
pm = dynamic
pm.max_requests = 0
pm.max_children = 2
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1
chroot = /home/vhosts/example.com/
request_terminate_timeout = 2
request_slowlog_timeout = 1
slowlog = /home/vhosts/example.com/log/php-slow.log
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
This is my lighttpd vhost:
$HTTP["host"] =~ "(^|.)example\.com$" {
server.document-root = "/home/vhosts/example.com/web"
server.errorlog = "/home/vhosts/example.com/log/error.log"
accesslog.filename = "/home/vhosts/example.com/log/access.log"
fastcgi.server = (
".php" => (
"localhost" => (
"docroot" => "/web",
"host" => "127.0.0.1",
"port" => "9001"
)
)
)
}
What is wrong? If I don't use mysql I can see the result of the php script correctly.
Turning on error display and posting those errors would be helpful, but since you can use mysql without chrooting php, I guess you are getting some connection error, since php tries to connect to mysql on localhost using socket ( php compiled with --with-mysql-sock=/var/mysql.sock), and most likely this socket is outside your chrooted environment.
You can try:
Recompiling php to not use socket
creating hard link to socket in your chrooted path
using some internal ip (like 10.0.0.1,192.168.0.1) instead of loopback
Seems to me all the problems are because of the user and group being example.com
i guess that user doesnt have rights to perform the requested tasks
Related
Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php
Below My Config.php
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost = '192.0.0.0';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'root';
$CFG->dbpass = 'admindb#123';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => 3306,
'dbsocket' => '',
'dbcollation' => 'utf8mb4_general_ci',
);
$CFG->wwwroot = 'http://192.0.0.0/moodle-apexon';
$CFG->dataroot = 'C://xampp//moodledata';
$CFG->admin = 'admin';
Try connecting to the database via the command line. If that doesn't work then check the username, password, dbname etc.
mysql --user=root --password=admindb#123 --host=192.0.0.0 moodle
I am attempting to create a Route53 entry for a MySQL RDS instance but having issues with the :3306 at the end of the RDS endpoint returned from Terraform.
resource "aws_db_instance" "mydb" {
allocated_storage = 10
engine = "mysql"
engine_version = "5.6.17"
instance_class = "db.t2.micro"
name = "mydb"
username = "foo"
password = "bar"
db_subnet_group_name = "my_database_subnet_group"
parameter_group_name = "default.mysql5.6"
}
resource "aws_route53_record" "database" {
zone_id = "${aws_route53_zone.primary.zone_id}"
name = "database.example.com"
type = "CNAME"
ttl = "300"
records = ["${aws_db_instance.default.endpoint}"]
}
Terraform puts a :3306 at the end of the endpoint and that gets entered into the Route53 Value of the CNAME.
When I then try to connect to the CNAME database.example.com with the MySQL client I get:
ERROR 2005 (HY000): Unknown MySQL server host 'database.example.com' (0)
Once I remove the :3306 via the AWS route53 console It seems work just fine.
Question is: How do I strip the :3306 from the Terraform RDS endpoint
As well as an endpoint output, Terraform's aws_db_instance resource also outputs address that provides the FQDN of the instance.
So all you need to do is change your aws_route53_record resource to use address instead:
resource "aws_db_instance" "mydb" {
allocated_storage = 10
engine = "mysql"
engine_version = "5.6.17"
instance_class = "db.t2.micro"
name = "mydb"
username = "foo"
password = "bar"
db_subnet_group_name = "my_database_subnet_group"
parameter_group_name = "default.mysql5.6"
}
resource "aws_route53_record" "database" {
zone_id = "${aws_route53_zone.primary.zone_id}"
name = "database.example.com"
type = "CNAME"
ttl = "300"
records = ["${aws_db_instance.mydb.address}"]
}
Today I was trying to use sphinxsearch with SphinxQL but something going bad =\
First I installed sphinxsearch then I configured it, after that I created index forum_index using indexer --all. All finished without errors.
Then I included SphinxQl to my project, typed host and port which is listening sphinx and tried to make a query like in ReadMe of SphinxQL:
// create a SphinxQL Connection object to use with SphinxQL
$conn = new Connection();
$conn->setParams(array('host' => 'localhost', 'port' => 9306))
;
But it caused a database access error:
access denied www-data#localhost password NO
After that I set parameters of username and password in SphinxQL using
mysqli::real_connect()
Previous errors disappeared
Then I tried to make a test query:
$query = SphinxQL::create($conn)->select('column_one', 'colume_two')
->from('forum_index');
$result = $query->execute();
But I get an error:
table forum_index doesn't exists
I have a feel that my SphinxQL doesn't see sphinx or sphinx config and tries to make a simple query.
Have you any idea what's going wrong?
Please go to command line use the following command
mysql -P9306 --protocol=tcp --prompt='sphinxQL> '
Once get sphinxQL prompt enter the following command
sphinxQL> show tables;
If you set up everything correctly you can see the forum_index table in the list. Else check your searchd configuration section in your sphinx.conf file for proper configuration. My configuration look like this
searchd {
listen = 9315
listen = 9306:mysql41
log = /Users/XXXX/projects/sphinx/data/searchd.log
query_log = /Users/XXXX/projects/sphinx/data/query.log
read_timeout = 5
max_children = 30
pid_file = /Users/XXXX/projects/sphinx/data/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
workers = threads
thread_stack = 1024K
}
I solved my problem by setting host = '127.0.0.1' in SphinxQL params
i'm having a little problem. I'm using Debian and I got asterisk 1.8 and I want to use CDR along with mysql.
In Asterisk 1.8 you apparently gotta use cdr-adaptive module instead of the regular. That is just what I did. Now I have 1 error when I "module reload cdr_adaptive_odbc.so" and I can't solve it :
WARNING[23172]: cdr_adaptive_odbc.c:123 load_config: No such connection 'MySQL-asterisk' in the 'adaptive-connection' section of cdr_adaptive_odbc.conf. Check res_odbc.conf.
Now here are all the files related, I can't understand what is wrong :
/etc/odbc.ini :
[MySQL]
Description = MySQL ODBC MyODBC Driver
Driver = /usr/lib/libmyodbc3.so
FileUsage = 1
[Text]
Description = ODBC for Text Files
Driver = /usr/lib/libodbctxt.so
Setup = /usr/lib/libodbctxtS.so
FileUsage = 1
CPTimeout =
CPReuse =
[PostgreSQL]
Description = PostgreSQL driver for Linux & Win32
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so
FileUsage = 1
[DB2]
Description = DB2 Driver
Driver = /opt/IBM/db2/V8.1/lib64/libdb2.so
FileUsage = 1
DontDLClose = 1
DMEnvAttr = SQL_ATTR_UNIXODBC_ENVATTR={DB2INSTANCE=db2inst1}
[MySQL-asterisk]
Description = MySQL asterisk database
Driver = MySQL
Socket = /var/run/mysqld/mysqld.sock
Server = localhost
User = root
Password = XXXXX
Database = ics
Option = 3
/etc/asterisk/cdr_adaptive_odbc.conf :
[adaptive-connection]
connection = MySQL-asterisk
table = cdr
alias start => calldate
/etc/asterisk/res_odbc.conf :
[Asterisk]
enabled => yes
dsn => MySQL-asterisk
username => root
password => XXX
;pooling => no
;limit => 0
pre-connect => yes
This is what I get when i check the cdd status :
Call Detail Record (CDR) settings
----------------------------------
Logging: Enabled
Mode: Simple
Log unanswered calls: No
* Registered Backends
-------------------
Adaptive ODBC
cdr-custom
ODBC
csv
radius
res_config_sqlite
And this is what I get when i check de odcb
ODBC DSN Settings
-----------------
Name: Asterisk
DSN: MySQL-asterisk
I can't figure out what's wrong. Anyone has an idea ?
I assume you've fixed this now. I ran into a similar issue and the problem stemmed from the documentation. It refers to connection= in cdr_adaptive_odbc.conf being the DSN name. It's the name you want and not the DSN. So in your case:
connection = Asterisk
then at the command line do a
CLI> module reload cdr_adaptive_odbc.so
and you should see a screenfull as Asterisk finds the tables and does any mappings you have specified.
I tried to install proxy on development machine and I got the following error.
/etc/init.d/mysql-proxyd start
Starting mysql-proxy: 2011-02-26 15:51:45: (critical) admin-plugin.c:569: --admin-username needs to be set
2011-02-26 15:51:45: (critical) mainloop.c:267: applying config of plugin admin failed
2011-02-26 15:51:45: (critical) mysql-proxy-cli.c:596: Failure from chassis_mainloop. Shutting down.
[ OK ]
Since this is only a test machine, I do not want the security feature of proxy. How do I avoid the above error?
Either upgrade your version of mysql-proxy to 0.8.2 or greater or explicitly specify that you don't need the admin plugin by using mysql-proxy --plugins=proxy
[mysql-proxy]
daemon = true
user = mysql
proxy-skip-profiling = true
keepalive = true
max-open-files = 2048
event-threads = 50
pid-file = /var/run/mysql-proxy.pid
log-file = /var/log/mysql-proxy.log
log-level = debug
admin-address=:4401
admin-username=1
admin-password=1
admin-lua-script=/usr/local/lib/mysql-proxy/lua/admin.lua
proxy-address = 0.0.0.0:3307
proxy-backend-addresses = 192.168.2.1:3306
proxy-read-only-backend-addresses=192.168.6.2:3306, 192.168.6.1:3306
proxy-lua-script=/usr/lib/mysql-proxy/lua/proxy/balance.lua