script works on local host but not on live server

I have below script. It works perfect on local host but does not work on live server (hosting).

Actually the input value is from array but does not work.

echo $user_info[0] = 'http://'.Punycode::encodeHostname(trim($user_info[0]));

While this line input is given manually and it works perfect on live server.

echo $convert = 'http://'.Punycode::encodeHostname(trim('bü')); 

The code


$post_list  = array();


if(isset($_POST["submit"])) {

    //$txturl = preg_replace('#^https?://#', '', rtrim($_POST['links'],'/'));
     $input_list =  preg_replace('/n+/', "n", trim($_POST['urllist']));

    $input_list = explode("n", $input_list);

        for($i=0;$i<count($input_list);$i++) {

            $post_list = (trim($input_list[$i]));
            $user_info = explode('|', $post_list);

            $user_info[0] = preg_replace('#^https?://#', '', rtrim($user_info[0],'/'));

            echo $user_info[0] = 'http://'.Punycode::encodeHostname(trim($user_info[0])); // This is not working Punycode::encodeHostname(trim($user_info[0]))
            echo '<br>';
            echo $convert = 'http://'.Punycode::encodeHostname(trim('bü')); // This line work perfect.

            $outputlist .= 'Scrpated vlaue for input ' . $user_info[0]. '==>' .$user_info[1] . '==>' . $user_info[2] .'
' ;

<form method="POST" action="problem.php">
<textarea name = "urllist" rows ="20" cols="150" placeholder="Past Urls here!|phonenumber|"><?php if(!empty($_POST["urllist"])) { echo $_POST["urllist"]; } ?></textarea>   
<textarea name = "output" rows ="20" cols="150"  > <?php echo $outputlist;  ?></textarea>   
<input type="submit" name="submit" value="Generate">

Use this line for input test..


This script is live here

Source: stackoverflow-php

Cannot connect to mysql local host all settings seem correct

I have been all over S.O. and almost all questions invariably give the same answers .. I must be missing something glaringly obvious in my setup:

The questions I have viewed and followed are extensive — So I really am banging my head against a wall here ..

my user is ‘devUser’ in this case:

enter image description here

My PHP is:

$server = "localhost"; // -- YES I'VE ALSO TRIED, AND LOCAL
$database = "some_database";
$username = "devUser";
$password = "some_pass"; // This pass works for MySQL workbench -- It's good

$mysqlConnection = new mysqli($server, $username, $password);

if (!$mysqlConnection) {
    die("There was a problem processing your request!");
    // For debugging -- die("Connection failed: " . $conn->connect_error);
} else {
    mysqli_select_db($mysqlConnection, $database);

It’s worth mentioning that Workbench connects successfully with that user using ssh tunnel -> –> 3306 –> devUser –> some_pass

Also my my.cnf is set to bind-address

socket          = /var/run/mysqld/mysqld.sock
nice            = 0


user            = mysql
pid-file        = /var/run/mysqld/
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql

bind-address            =

key_buffer_size         = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
myisam-recover-options  = BACKUP
query_cache_limit       = 1M
query_cache_size        = 16M
log_error = /var/log/mysql/error.log
expire_logs_days        = 10
max_binlog_size   = 100M

This isn’t rocket science, but my brain is tired and I think I am having tunnel vision — Can someone see the glaring error?

Source: stackoverflow-php