xDebug not connecting with Netbeans - xdebug

I have vm (centos 7, apache, php 5.4). Small test php script works with no problem. When i try to debug it Netbeans (8.0.2 on windows 8.1) shows 'waiting for connection' and nothing more happens. I am using ssh tunnel from vm port 9005 to host port 9005.
xdebug log:
Log opened at 2015-08-16 18:11:22
I: Connecting to configured address/port: localhost:9005.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/project/html/index.php" language="PHP" protocol_version="1.0" appid="55867" idekey="netbeans-xdebug"><engine version="2.3.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2015 by Derick Rethans]]></copyright></init>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
Log closed at 2015-08-16 18:11:24
Result from php -i :
xdebug support => enabled
IDE Key => netbeans-xdebug
xdebug.auto_trace => Off
xdebug.cli_color => 0
xdebug.collect_assignments => Off
xdebug.collect_includes => On
xdebug.collect_params => 0
xdebug.collect_return => Off
xdebug.collect_vars => Off
xdebug.coverage_enable => On
xdebug.default_enable => On
xdebug.dump.COOKIE => no value
xdebug.dump.ENV => no value
xdebug.dump.FILES => no value
xdebug.dump.GET => no value
xdebug.dump.POST => no value
xdebug.dump.REQUEST => no value
xdebug.dump.SERVER => no value
xdebug.dump.SESSION => no value
xdebug.dump_globals => On
xdebug.dump_once => On
xdebug.dump_undefined => Off
xdebug.extended_info => On
xdebug.file_link_format => no value
xdebug.force_display_errors => Off
xdebug.force_error_reporting => 0
xdebug.halt_level => 0
xdebug.idekey => netbeans-xdebug
xdebug.max_nesting_level => 256
xdebug.max_stack_frames => -1
xdebug.overload_var_dump => On
xdebug.profiler_aggregate => Off
xdebug.profiler_append => Off
xdebug.profiler_enable => Off
xdebug.profiler_enable_trigger => Off
xdebug.profiler_enable_trigger_value => no value
xdebug.profiler_output_dir => /tmp
xdebug.profiler_output_name => cachegrind.out.%p
xdebug.remote_autostart => Off
xdebug.remote_connect_back => Off
xdebug.remote_cookie_expire_time => 3600
xdebug.remote_enable => On
xdebug.remote_handler => dbgp
xdebug.remote_host => localhost
xdebug.remote_log => /var/log/xdebug/debug.log
xdebug.remote_mode => req
xdebug.remote_port => 9005
xdebug.scream => Off
xdebug.show_exception_trace => Off
xdebug.show_local_vars => Off
xdebug.show_mem_delta => Off
xdebug.trace_enable_trigger => Off
xdebug.trace_enable_trigger_value => no value
xdebug.trace_format => 0
xdebug.trace_options => 0
xdebug.trace_output_dir => /tmp
xdebug.trace_output_name => trace.%c
xdebug.var_display_max_children => 128
xdebug.var_display_max_data => 2048
xdebug.var_display_max_depth => 3
I tried same config with XDebugClient and it worked -> so it is probably some issues with Netbeans.
remote log with XDebugClient:
Log opened at 2015-08-16 19:43:51
I: Connecting to configured address/port: localhost:9005.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/project/html/index.php" language="PHP" protocol_version="1.0" appid="58314" idekey="netbeans-xdebug"><engine version="2.3.3"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2015 by Derick Rethans]]></copyright></init>
<- run -i xdc2
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="xdc2" status="break" reason="ok"><xdebug:message filename="file:///var/www/project/html/index.php" lineno="13"></xdebug:message></response>
<- step_out -i xdc10
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_out" transaction_id="xdc10" status="stopping" reason="ok"></response>
Log closed at 2015-08-16 19:45:11

in the settings you have
xdebug.remote_host => localhost
you should have the IP address of the remote machine (the one that runs netbeans), and i assume you should have the debuging port opened on windows firewall, so centos can connect back to that port in your netbeans. i haven't done remote debugging on other machines, always local, but this should work.
XDebug sample static ip/single developer:
The IP of the server is 10.0.1.2 with HTTP on port 80
The IDE is on IP 10.0.1.42, so xdebug.remote_host is set to 10.0.1.42
The IDE listens on port 9000, so xdebug.remote_port is set to 9000
The HTTP request is started on the machine running the IDE
Xdebug connects to 10.0.1.42:9000
Debugging runs, HTTP Response provided
Xdebug documentation:
http://xdebug.org/docs/remote

Related

Laravel 8.74 - CloudLinux9 - MSSQL11 - ODBC Driver18 - Connection TrustCertificate=1 issue

I am having trouble to add options for laravael config/database.php;
TrustServerCertificate
Encryption
I am getting below error when trying to connect to MSSQL database;
SQLSTATE[08001]: [Microsoft][ODBC Driver 18 for SQL Server]SSL
Provider: [error:1416F086:SSL
routines:tls_process_server_certificate:certificate verify failed:self
signed certificate]
database information is below without TrustServerCertificate&Encryption
'000002' => [
'driver' => 'sqlsrv',
'odbc_driver' => '{ODBC Driver 18 for SQL Server}',
'host' => 'WWW.XXX.YYY.ZZZ',
'database' => 'database_name',
'username' => 'user_name',
'password' => 'pass_word',
'port' => '1433',
'prefix' => '',
'charset' => 'utf8',
]
but when I try with RAW php with below code including TrustServerCertificate it works;
<?php
$host = "WWW.XXX.YYY.ZZZ";
$user = "user_name";
$password = "pass_word";
$dbname="database_name";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_CASE => PDO::CASE_NATURAL,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_EMPTY_STRING
];
try {
$connection = new PDO("sqlsrv:Server=$host,1433; Database=$dbname;TrustServerCertificate=1", $user, $password);
} catch(PDOException $e) {
die("Database connection failed: " . $e->getMessage());
exit;
}
echo"Connection Successful";
?>
How can I add this to Laravels database configuration information?
I tried multiple ways as below but didn't help;
TrustServerCertificate = 1,
TrustServerCertificate = '1',
TrustServerCertificate = 'true',
TrustServerCertificate = true,
trust_server_certificate = 1,
trust_server_certificate = '1',
trust_server_certificate = 'true',
trust_server_certificate = true,
Should it be under an options array?
What should be the setting for ODBC18 driver?
Thanks
If anyone bumps into this issue, just rollback to ODBC driver 17. ODBC driver 18 comes with SSL/Certificate and Encryption requirement as default. If you are able to acquire ssl licences for your servers, do use version 18.
Happy coding :)

Memcached setup with cakephp3

I am setting up memcache setup with cakephp3. I added below in config/app.php
'Cache' => [
'default' => [
'className' => 'Cake\Cache\Engine\MemcachedEngine',
],
]
On the top of the controller I added
use Cake\Cache\Cache;
use Cake\Cache\CacheEngine;
use Cake\Cache\CacheRegistry;
But when I used any function of memcache like Cache::write('variable','value'); etc
It is giving me error
" Error: Cache engine Cake\Cache\Engine\MemcachedEngine is not properly configured. "
The memcached is installed on server.. here is the output
/etc/php.d/memcache.ini,
memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 32768 => 32768
memcache.compress_threshold => 20000 => 20000
memcache.default_port => 11211 => 11211
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => consistent => consistent
memcache.lock_timeout => 15 => 15
memcache.max_failover_attempts => 20 => 20
memcache.protocol => ascii => ascii
memcache.redundancy => 1 => 1
memcache.session_redundancy => 2 => 2
Please let me know what is the remaining in configuration. Thanks in advance.
Wrong extension
There are two php extensions related to memcache:
Memcache (older)
Memcached (newer, more features)
The CakePHP Memcached driver relies on memcacheD:
if (!extension_loaded('memcached')) {
return false;
}
Which will result in that error message if it's missing:
if (!$instance->init($config)) {
throw new RuntimeException(
sprintf('Cache engine %s is not properly configured.', get_class($instance))
);
}

What about problems with loading native library/missing methods: libttJdbc.so, libtten.so

java.sql.SQLException: Problems with loading native library/missing methods: /home/timesten/TimesTen/tt1122/lib/libttJdbc.so: libtten.so: cannot open shared object file: No such file or directory
at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:1794)
at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:305)
at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:161)
at java.sql.DriverManager.getConnection(DriverManager.java:620)
at java.sql.DriverManager.getConnection(DriverManager.java:222)
at Test.main(Test.java:15)
Thankyou
Code Example:
try{
String driverName = "com.timesten.jdbc.TimesTenClientDriver"; // "sun.jdbc.odbc.JdbcOdbcDriver"
String Url = "jdbc:timesten:client:dsn=timestendb_1122"; //"jdbc:odbc:timestendb_1122";
if(args.length >= 2){
driverName = args[0];
Url = args[1];
}
System.out.println("driverName=" + driverName);
System.out.println("Url=" + Url);
System.out.println("classPath=" + System.getProperty("java.library.path"));
Class.forName(driverName).newInstance();
// Open a connection to TimesTen
Connection conn = DriverManager.getConnection(Url);
if(conn != null){
System.out.println("okay");
}
else{
System.out.println("fail");
}
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
odbc.ini config:
[ODBC Data Sources]
timestendb_11221=TimesTen 11.2.2 Driver
[timestendb_1122]
TTC_SERVER=(Host || IP)
UID=Username
PWD=Password
TTC_SERVER_DSN=Cachedb01
Error: java.sql.SQLException: Problems with loading native
library/missing methods: /opt/TimesTen/tt1122/lib/libttJdbcCS.so:
libttclient.so: cannot open shared object file: No such file or
directory
Resolve:
Check if exists:
$ldd /opt/TimesTen/tt1122/lib/libttJdbcCS.so
Screen:
linux-vdso.so.1 => (0x00007fff039b4000)
libttclient.so => not found
libttco.so => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f57d642e000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f57d6218000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f57d5e58000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f57d5c53000)
/lib64/ld-linux-x86-64.so.2 (0x00007f57d6876000)
Check directory timesten client: $ ll /opt/TimesTen/tt1122/lib/libttclient.so
Go to to file to add share lib : sudo vi /etc/ld.so.conf.d/extension.conf -> Add: /opt/TimesTen/tt1122/lib
Check Again
java -Djava.library.path=/opt/TimesTen/tt1122/lib -jar test1.jar
Code Print:
driverName=com.timesten.jdbc.TimesTenClientDriver
Url=jdbc:timesten:client:dsn=timestendb_1122
classPath=/opt/TimesTen/tt1122/lib
java.sql.SQLException: [TimesTen][TimesTen 11.2.2.5.0 CLIENT]Cannot find the requested DSN (timestendb_1122) in ODBCINI, Unable to open /var/TimesTen/tt1122/sys.odbc.ini. Permission denied
Resolve:
export ODBCINI=/etc/odbc.ini (if you used odbc driver)
export ODBCINI=/var/TimesTen/tt1122/sys.odbc.ini (if used timesten driver)
Can be add bash file for user:
nano /home/nhatvd/.bashrc
export ODBCINI=/etc/odbc.ini
$ ldd /opt/TimesTen/tt1122/lib/libttJdbcCS.so
linux-vdso.so.1 => (0x00007fff429fe000)
libttclient.so => /opt/TimesTen/tt1122/lib/libttclient.so (0x00007fd7977ee000)
libttco.so => /opt/TimesTen/tt1122/lib/libttco.so (0x00007fd797520000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd797223000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd79700d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd796c4d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd796a48000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd796748000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd79652b000)
libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fd796310000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd797b12000)
Result:
$ java -Djava.library.path=/opt/TimesTen/tt1122/lib -jar test1.jar
Code Print:
driverName=com.timesten.jdbc.TimesTenClientDriver
Url=jdbc:timesten:client:dsn=timestendb_1122
classPath=/opt/TimesTen/tt1122/lib
okay
DONE.

CakeEmail and SMTP Error 535

I'm using cakephp 2.3.0 and i want send email using devocot + postfix. SMTP work fine because i have installed roundCube and hi received emails and sends emails.
class EmailConfig {
public $default = array(
'host' => 'poczta.example.com',
'port' => 25,
'auth' => 'plain',
'username' => 'username#poczta.example.com',
'password' => '**********',
'tls' => true,
'transport' => 'Smtp',
'from' => array('username#poczta.example.com' => 'Username'),
'returnPath' => 'username#poczta.example.com',
'layout' => false,
'emailFormat' => 'html',
'template' => 'only_text',
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
);
}
Code for send emails:
try {
$oEmail->reset();
$oEmail->config('default');
$oEmail->to(preg_replace('/&#?[a-z0-9]+;/i', '' , trim($v['Email']['email']) ));
$oEmail->subject($subject);
$content = str_replace('${id}', md5($v['Email']['id']), $context);
$content = str_replace('queueId', $queueId, $content);
$oEmail->viewVars(array('email' => $content));
if($oEmail->send()) {
$last = $v['Email']['id'];
$send++;
}
}
catch(Exception $e) {
$this->out($e->getMessage());
}
And i see i console:
SMTP Error: 535 5.7.8 Error: authentication failed: Invalid authentication mechanism
So quick test with telnet:
telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 poczta.example.com ESMTP Postfix (Debian/GNU)
ehlo testing
250-poczta.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
So please help me how i sent email using cake ?
EDIT: i have tls in email config file.
It is not tsl as you have it in your config, it is tls

dtrace libc probes on opensolaris

when im trying to do trace getenv function i got:
-bash-4.0#/usr/sbin/dtrace -n 'pid$target:libc:getenv:entry' -p 2017
dtrace: invalid probe specifier pid$target:libc:getenv:entry: probe description
pid2017:libc:getenv:entry does not match any probes
-bash-4.0# /usr/sbin/dtrace -n 'pid$target:libc::entry' -p 2017
dtrace: invalid probe specifier pid$target:libc::entry: probe description pid2017:libc::entry does not match any probes
ldd from myapp:
libz.so.1 => /lib/libz.so.1
libm.so.2 => /lib/libm.so.2
libdl.so.1 => /lib/libdl.so.1
libpthread.so.1 => /lib/libpthread.so.1
libbz2.so.1 => /usr/lib/libbz2.so.1
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libsendfile.so.1 => /lib/libsendfile.so.1
libxml2.so.2 => /lib/libxml2.so.2
libc.so.1 => /lib/libc.so.1
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
libscf.so.1 => /lib/libscf.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
libsmbios.so.1 => /usr/lib/libsmbios.so.1
Why is that happening ? Is there any solution which can make libc functions able to trace via dtrace ?
Best regards

Resources