Insert not working quitely. PDO [on hold]

I've defined the database information in a config file and made sure the config file is included and this is the error I get.

Also tried entering the data connection information myself and then the query runs but there is no data in the database.

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. ' in C:\xampp\htdocs\new\core\includes\send_order.php:92 Stack trace: #0 C:\xampp\htdocs\new\core\includes\send_order.php(92): PDO->__construct('mysql:host=DB_H...', 'DB_USER', 'DB_PASS') #1 C:\xampp\htdocs\new\index.php(57): include('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\new\core\includes\send_order.php on line 92

Config file

define("DB_HOST", "127.0.0.1");
define("DB_NAME", "avion");
define("DB_USER", "root");
define("DB_PASS", "password");

and for my INSERT query.

    $conn = new PDO('mysql:host='. DB_HOST .';dbname='. DB_NAME . ';charset=utf8', DB_USER, DB_PASS);
    $query_new_order_insert = $conn->prepare('INSERT INTO `orders` (`user_id`, `user_name`, `specific_color`, `specific_style`, `webcam_size`, `monitor_resolution`, `faster_delivery`, `order_message`, `order_date`, `user_ip`) VALUES(:user_id, :user_name, :specific_color, :specific_style, :webcam_size, :monitor_resolution, :faster_delivery, :order_message, :order_date, :user_ip)');
    $query_new_order_insert->bindValue(':user_id', $user_id, PDO::PARAM_INT);
    $query_new_order_insert->bindValue(':user_name', $user_name, PDO::PARAM_STR);
    $query_new_order_insert->bindValue(':specific_color', $color, PDO::PARAM_STR);
    $query_new_order_insert->bindValue(':specific_style', $style, PDO::PARAM_STR);
    $query_new_order_insert->bindValue(':webcam_size', $webcam, PDO::PARAM_STR);
    $query_new_order_insert->bindValue(':monitor_resolution', $monitor, PDO::PARAM_STR);
    $query_new_order_insert->bindValue(':faster_delivery', $faster_delivery, PDO::PARAM_INT);
    $query_new_order_insert->bindValue(':order_message', $message, PDO::PARAM_STR);
    $query_new_order_insert->bindValue(':order_date', date('d-F-Y, h:i a'), PDO::PARAM_STR);
    $query_new_order_insert->bindValue(':user_ip', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR);
    $query_new_order_insert->execute();

Update: Database connection is established but the data isn't being inserted to the database.

Executing an .exe file via php (SOLVED)

I have the following problem:

I run an XAMPP Apache server on a Windows 7 x64 machine which I want to remote access and then execute a program on. Right now I have two files in the htdocs directory, index.php and test.php.

index.php:

  <a href="test.php">Click here</a> 

test.php:

    <?php
exec("C:\\xampp\\htdocs\\notepad.exe");
?> 

The index.php opens up the test.php but thats where I get stuck. The browser now doesn't respond and just shows "waiting for localhost" until it times out.

I have spent hours trieing to figure out the problem but nothing helps.

Apache denied access by server configuration for yii project

I found this error in my cache error log: [client 127.0.0.1:51412] AH01630: client denied by server configuration: D:/webroot/sri3/.htaccess

I found topics in the site like : https://stackoverflow.com/questions/ask?title=client%20denied%20by%20server%20configuration

client denied by server configuration This not meet my needs.

My Apache is 2.4.9 Windows and the httpd.conf was not megrated, was only changed in paths related to my machine.

Recently i install yii 2.00

The public folder to access is localhost/sri3/web. But i need localhost/sri3/

To Rewrite all access from the /sri3 project folder to the web subfolder y create this .htaccess file :

RewriteEngine on
RewriteRule ^sri3/(.*)$ /sri3/web/$1 [NC,L]

My httpd.conf has :

LoadModule rewrite_module modules/mod_rewrite.so
ServerName 127.0.0.1
<Directory />
    AllowOverride none
    Require all granted
</Directory>
DocumentRoot "D:/webroot"
<Directory "D:/webroot">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require local
</Directory>

How to solve the access denied ?

to get, all access from localhost/sri3 redirected to localhost/sri3/web/index.php ?

My parcial solution ( only parcial ), i create a junk link in D:/webroot/sri2 at O.S. level pointing to D:/webroot/sri3/web

But this is not i whant.

How do I do a URL rewrite on Lighttpd?

I currently have the following code in my sites .htaccess:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+admin\.php\?page=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=302,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ admin.php?page=$1 [L,QSA]

However I now have to move everything into lighttpd instead of Apache, is it even possible to replicate this url rewrite, and if so, how?

Perl – .htaccess How do I redirect incoming query by popping off part of string

I need to add this function to my .htaccess file.

I have this query coming in from other domains.

http://Domain.com/some-folder/blue-widget/large/bluewidget-number-yada-60467.htm

I need that to go to:

http://Domain.com/60467

I found a way to match 5 or 6 digits .htm at the end of the query but, how do I implement this as a "redirect"?

<FilesMatch "\d{5,6}\.htm?$">

in something like:

RewriteRule \d{5,6}\.htm?$ http://Domain.com/60467

Do I need a rewrite Condition first?

RewriteCond %{QUERY_STRING} (\d{5,6}\.htm?$)

Here is the hard part. Is it also possible the have it ignore that rule if the query is generated from the domain the .htaccess is located on (Domain.com)? Not necessary but, I would like to be able to do that too.

I really cannot figure this out..

.htaccess rewrite only when there is a slash in the URL

In my root directory I have files but I want the rewrite to work only if there is a slash.

I have urls at the moment as www.mysite.com/index.php?id=10&id1=234. I want instead to have urls like www.mysite.com/234 that rewrite to passthrough.php?id=234.

I will use php to redirect. The important point is the rewrite should only happen if there is a slash so it does not conflict with other stuff.

Thanks in advance!