Openshift wordpress app: can't connect to mysql database - mysql

I have just set up an openshift wordpress application environment (http://eigenbouw-vanhove.rhcloud.com/) but i can't get a connection to the mysql database. I added the phpmyadmin cartridge and i think i set the right information in my wp-config.
The error i'm getting when surfing to the site:
Error establishing a database connection
My wp-config:
$EBmysql = getenv('OPENSHIFT_MYSQL_DB_URL');
$EBmysqlUser = getenv('OPENSHIFT_MYSQL_DB_USERNAME');
$EBmysqlPass = getenv('OPENSHIFT_MYSQL_DB_PASSWORD');
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'eigenbouw');
/** MySQL database username */
define('DB_USER', $EBmysqlUser);
/** MySQL database password */
define('DB_PASSWORD', $EBmysqlPass);
/** MySQL hostname */
define('DB_HOST', $EBmysql);
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
The log files don't contain any errors it seems:
==> mysql/log/mysql_start.log <==
140318 18:34:51 mysqld_safe Logging to '/var/lib/openshift/5328c0ca50044622b20002dc/mysql//log/mysql_error.log'.
140318 18:34:52 mysqld_safe Starting mysqld daemon with databases from /var/lib/openshift/5328c0ca50044622b20002dc/mysql/data/
==> mysql/log/mysql_error.log <==
140318 18:34:52 InnoDB: highest supported file format is Barracuda.
140318 18:34:52 InnoDB: Waiting for the background threads to start
140318 18:34:53 InnoDB: 5.5.36 started; log sequence number 2226531
140318 18:34:53 [Note] Server hostname (bind-address): '127.13.143.130'; port: 3306
140318 18:34:53 [Note] - '127.13.143.130' resolves to '127.13.143.130';
140318 18:34:53 [Note] Server socket created on IP: '127.13.143.130'.
140318 18:34:53 [Warning] 'proxies_priv' entry '# root#ex-std-node306.prod.rhcloud.com' ignored in --skip-name-resolve mode.
140318 18:34:53 [Note] Event Scheduler: Loaded 0 events
140318 18:34:53 [Note] /opt/rh/mysql55/root/usr/libexec/mysqld: ready for connections.
Version: '5.5.36' socket: '/var/lib/openshift/5328c0ca50044622b20002dc/mysql//socket/mysql.sock' port: 3306 MySQL Community Server (GPL)
==> mysql/log/install_db.log <==
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt/rh/mysql55/root/usr ; /opt/rh/mysql55/root/usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/rh/mysql55/root/usr/mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
==> php/logs/access_log-20140318-000000-EST <==
178.116.245.86 - - [18/Mar/2014:18:13:15 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:15 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:22 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:24 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:26 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:16:29 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:35:42 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:35:44 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:35:45 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:36:25 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
==> php/logs/error_log-20140318-000000-EST <==
[Tue Mar 18 18:05:29 2014] [error] [client 127.13.143.129] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Tue Mar 18 18:05:30 2014] [error] [client 127.13.143.129] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Tue Mar 18 18:12:13 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c826
[Tue Mar 18 18:12:14 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 18 18:12:14 2014] [notice] Digest: done
[Tue Mar 18 18:12:14 2014] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations
[Tue Mar 18 18:35:18 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c826
[Tue Mar 18 18:35:19 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 18 18:35:19 2014] [notice] Digest: done
[Tue Mar 18 18:35:19 2014] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations
==> phpmyadmin/logs/access_log-20140318-000000-EST <==
178.116.245.86 - - [18/Mar/2014:18:35:52 -0400] "GET /phpmyadmin/themes/pmahomme/img/arrow_ltr.png HTTP/1.1" 200 139 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:35:53 -0400] "GET /phpmyadmin/db_structure.php?server=1&db=eigenbouw&token=abf8131a63f3f81249051839468aa0af&ajax_request=true&ajax_page_request=true&menuHashes=3a627a2c-d774b552-9e6d7974-08f204f8&_nocache=1395182166321431500 HTTP/1.1" 200 38411 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:03 -0400] "GET /phpmyadmin/sql.php?db=eigenbouw&token=abf8131a63f3f81249051839468aa0af&goto=db_structure.php&table=wp_posts&pos=0&ajax_request=true&ajax_page_request=true&menuHashes=3a627a2c-d774b552-9e6d7974-08f204f8&_nocache=1395182176714675967 HTTP/1.1" 200 148961 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/themes/pmahomme/img/s_fulltext.png HTTP/1.1" 200 193 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/js/get_scripts.js.php?scripts[]=tbl_structure.js&scripts[]=gis_data_editor.js HTTP/1.1" 200 31426 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/themes/pmahomme/img/col_pointer.png HTTP/1.1" 200 113 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/phpmyadmin.css.php?server=1&token=abf8131a63f3f81249051839468aa0af&nocache=5539948530ltr" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - - [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/themes/pmahomme/img/col_drop.png HTTP/1.1" 200 132 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/phpmyadmin.css.php?server=1&token=abf8131a63f3f81249051839468aa0af&nocache=5539948530ltr" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:06 -0400] "GET /phpmyadmin/index.php?ajax_request=1&recent_table=1&token=abf8131a63f3f81249051839468aa0af HTTP/1.1" 200 221 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:14 -0400] "GET /phpmyadmin/index.php?token=abf8131a63f3f81249051839468aa0af&ajax_request=true&ajax_page_request=true&menuHashes=3a627a2c-d774b552-9e6d7974-08f204f8-f835d310&_nocache=1395182187916183155 HTTP/1.1" 200 35246 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
178.116.245.86 - adminHKLwWqh [18/Mar/2014:18:36:15 -0400] "GET /phpmyadmin/version_check.php?&_nocache=1395182189038290343 HTTP/1.1" 200 39 "https://eigenbouw-vanhove.rhcloud.com/phpmyadmin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
==> phpmyadmin/logs/error_log-20140318-000000-EST <==
[Tue Mar 18 18:05:55 2014] [notice] Digest: done
[Tue Mar 18 18:05:55 2014] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured -- resuming normal operations
[Tue Mar 18 18:12:09 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c826
[Tue Mar 18 18:12:10 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 18 18:12:10 2014] [notice] Digest: done
[Tue Mar 18 18:12:10 2014] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured -- resuming normal operations
[Tue Mar 18 18:35:14 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c826
[Tue Mar 18 18:35:15 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 18 18:35:15 2014] [notice] Digest: done
[Tue Mar 18 18:35:15 2014] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured -- resuming normal operations
==> php/logs/access_log-20140318-000000-EST <==
178.116.245.86 - - [18/Mar/2014:18:37:49 -0400] "GET / HTTP/1.1" 500 251 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0"
Any ideas?

The db url is not going to work, you need to use getenv('OPENSHIFT_MYSQL_DB_HOST') instead, and use the getenv('OPENSHIFT_MYSQL_DB_PORT') also if you are using a scaled application.
if you ssh into your gear and run 'env | grep MYSQL' you will see that the URL variable is not what it should be for WordPress to connect to the database.

Here are the database define statements pulled 17 April 2015 from OpenShift's sample WordPress app:
define('DB_NAME', getenv('OPENSHIFT_APP_NAME'));
define('DB_USER', getenv('OPENSHIFT_MYSQL_DB_USERNAME'));
define('DB_PASSWORD', getenv('OPENSHIFT_MYSQL_DB_PASSWORD'));
define('DB_HOST', getenv('OPENSHIFT_MYSQL_DB_HOST') . ':' . getenv('OPENSHIFT_MYSQL_DB_PORT'));
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
The full wp-config.php file can be found on Github:
https://github.com/openshift/wordpress-example/blob/master/.openshift/config/wp-config.php

Related

API Documentation on NGINX server

I have a Fastapi running on localhost:8020 and I have access to documentation with:localhost:8020/docs and the openapi.json file is in localhost:8020/openapi.json.
I want to redirect localhost:8020/docs to localhost:8080/docs with nginx. Here is my nginx.conf:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
sendfile on;
upstream docss {
server 172.17.0.1:8020;
}
server {
client_max_body_size 500M;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
client_body_timeout 600;
listen 8080;
resolver 127.0.0.11;
autoindex off;
server_name localhost;
server_tokens off;
location /docs/ {
proxy_pass http://docss/docs;
}
}
}
with the above config, when I open localhost:8080/docs/, I receive this error:
Failed to load API definition. Errors Hide Fetch error Not Found
/openapi.json
and in the nginx docker log, I receive this error:
172.21.0.1 - - [23/Jun/2022:18:10:35 +0000] "GET /docs/ HTTP/1.1" 200 931 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
2022/06/23 18:10:36 [error] 23#23: *1 open()
"/etc/nginx/html/openapi.json" failed (2: No such file or directory),
client: 172.21.0.1, server: localhost, request: "GET /openapi.json
HTTP/1.1", host: "localhost:8080", referrer:
"http://localhost:8080/docs/"
172.21.0.1 - - [23/Jun/2022:18:10:36 +0000] "GET /openapi.json HTTP/1.1" 404 548 "http://localhost:8080/docs/" "Mozilla/5.0 (Windows
NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/102.0.0.0 Safari/537.36"
I guess it means that it couldnot find openapi.json at "/etc/nginx/html/openapi.json".
So my question is that how can I import 172.17.0.1:8020/openapi.json which is the upstream connection to "/etc/nginx/html/openapi.json".
This is the command I use to create nginx docker:
docker run --link ds-ai-ocr_web_1 --link ds-ai-ocr_api_1 --net ds-ai-ocr_default --name nginx -v c:/Users/ab/Documents/ds-nginx-conf:/etc/nginx -p 8080:8080 -d nginx
I guess I should mount openapi.json through this command but it doesn't work like this:
docker run --link ds-ai-ocr_web_1 --link ds-ai-ocr_api_1 --net ds-ai-ocr_default --name nginx -v c:/Users/amd/Documents/ds-nginx-conf:/etc/nginx -v http://172.17.0.1:8020/openapi.json:/etc/nginx/html -p 8080:8080 -d nginx

YII2 got this error Access to font at - has been blocked by CORS policy

i cant found the answer for my problem because i use yii2
HEADERS - General
Request URL:
https://source.myweb.com/css/icons/icomoon/css/icomoon.css Request
Method: GET Status Code: 200 Remote Address: 104.27.189.114:443
Referrer Policy: no-referrer-when-downgrade
RESPONE HEADERS
cache-control: public, max-age=604800
cf-bgj: minify
cf-cache-status: HIT
cf-polished: origSize=48769
cf-ray: 4b3f84c7adf9c388-SIN
content-encoding: br
content-type: text/css
date: Thu, 07 Mar 2019 21:03:53 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Thu, 14 Mar 2019 21:03:53 GMT
last-modified: Wed, 20 Feb 2019 15:19:22 GMT
server: cloudflare
status: 200
vary: Accept-Encoding,User-Agent
x-turbo-charged-by: LiteSpeed
REQUEST HHEADERS
Provisional headers are shown
Referer: https://blog.myweb.com/
User-Agent: Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Mobile Safari/537.36
i was try many answer but i cant resolved this ?

Removing spaces out of a line after so many spaces has occured

So I am trying to do some tomcat access log analysis by getting it loaded into mysql. I have the majority of it working, but the last entry in the combined access log is kinda a pain, it does not always have the same spaces, and the file is space delimited. I need the last string in the file to either have the spaces removed or replaced with a comma or some other place holder.
I process the file through sed to remove all of the " from the file, so if i can add more to my sed command to do this that would be great, if i need to run it against something else after the sed command that will work to.
Here is the file before the sed command
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] "GET /irep/client/Cart/Controller/TempController.js HTTP/1.1" 304 - "webpage" "Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4"
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] "GET /irep/client/Libraries/jquery.mobile.datebox.js HTTP/1.1" 304 - "webpage" "Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4"
Here is the sed command
sed 's/\"//g' filename > newfilename
Here is an example string from the file after that command is ran against it. Since it is space delimited in mysql it tries to make several more columns and it cannot. so if i can get all the spaces out of the last section that would be awesome.
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] GET /irep/client/Content/css/jquery.mobile.datebox.css HTTP/1.1 304 - webaddress Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] GET /irep/client/Libraries/Bookmark.js HTTP/1.1 304 - webaddress Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4
Example of a string where Mozilla is not present.
24.240.97.38 - - [09/Feb/2015:07:38:21 -0600] GET /irep/images/integra.png HTTP/1.1 304 - - MobileSafari/600.1.4 CFNetwork/711.1.16 Darwin/14.0.0
Here is my expected output, sorry had several distractions this morning to this project.
IPAddress, ClientUsername, AuthUserName, DateTime, Request/File, Protocol, Status, SizeBytes, Referance address, UserAgent/Browser
I would post a screen shot of the table in mysql workbench but i am not allowed to yet.
Basically everything from "Mozilla" to the end of the row i want the spaces replaced or gone, i think a comma or : place holder would be ideal. Any suggestions?
Ed, here is the error I am getting when running it today.
awk: irep-istor_access_log.2015-02-10.txt:4: 166.173.58.240 - - [10/Feb/2015:00:04:07 -0600] "GET /istore/js/cart.js HTTP/1.1" 200 7042 "https://istore.salonservicegroup.com/istore/loginpage.jsp" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0"
awk: irep-istor_access_log.2015-02-10.txt:4: ^ syntax error
You can do the part you have left like this:
$ awk 'match($0,/Mozilla.*/){ tgt=substr($0,RSTART); gsub(/[[:space:]]+/,",",tgt); $0 = substr($0,1,RSTART-1) tgt } 1' file
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] GET /irep/client/Content/css/jquery.mobile.datebox.css HTTP/1.1 304 - webaddress Mozilla/5.0,(iPad;,CPU,OS,8_1_3,like,Mac,OS,X),AppleWebKit/600.1.4,(KHTML,,like,Gecko),Version/8.0,Mobile/12B466,Safari/600.1.4
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] GET /irep/client/Libraries/Bookmark.js HTTP/1.1 304 - webaddress Mozilla/5.0,(iPad;,CPU,OS,8_1_3,like,Mac,OS,X),AppleWebKit/600.1.4,(KHTML,,like,Gecko),Version/8.0,Mobile/12B466,Safari/600.1.4
but you should just be using one small, simple, awk script for the whole thing, whatever that is.
I see you just added some pre-sed input (but still no expected output) so:
$ cat file
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] "GET /irep/client/Cart/Controller/TempController.js HTTP/1.1" 304 - "webpage" "Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4"
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] "GET /irep/client/Libraries/jquery.mobile.datebox.js HTTP/1.1" 304 - "webpage" "Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4"
$
$ awk '{gsub(/"/,"")} match($0,/Mozilla.*/){ tgt=substr($0,RSTART); gsub(/[[:space:]]+/,",",tgt); $0 = substr($0,1,RSTART-1) tgt } 1' file
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] GET /irep/client/Cart/Controller/TempController.js HTTP/1.1 304 - webpage Mozilla/5.0,(iPad;,CPU,OS,8_1_3,like,Mac,OS,X),AppleWebKit/600.1.4,(KHTML,,like,Gecko),Version/8.0,Mobile/12B466,Safari/600.1.4
24.240.97.38 - - [09/Feb/2015:07:38:23 -0600] GET /irep/client/Libraries/jquery.mobile.datebox.js HTTP/1.1 304 - webpage Mozilla/5.0,(iPad;,CPU,OS,8_1_3,like,Mac,OS,X),AppleWebKit/600.1.4,(KHTML,,like,Gecko),Version/8.0,Mobile/12B466,Safari/600.1.4
Different approach: here is how to convert your input file into a CSV file:
$ cat tst.awk
BEGIN{
OFS=","
print "ipAddr", "dash1", "dash2", "dateTime", "getCmd", "number", "info", "browser"
}
{
gsub(OFS,";")
ip = $1
dash1 = $2
dash2 = $3
match($0,/\[[^]]+\]/)
dt = substr($0,RSTART+1,RLENGTH-2)
match($0,/"[^"]+"/)
get = substr($0,RSTART+1,RLENGTH-2)
$0 = substr($0,RSTART+RLENGTH)
num = $1
dash3 = $2
match($0,/"[^"]+"/)
info = substr($0,RSTART+1,RLENGTH-2)
$0 = substr($0,RSTART+RLENGTH)
match($0,/"[^"]+"/)
browser = substr($0,RSTART+1,RLENGTH-2)
print ip, dash1, dash2, dt, get, num, info, browser
}
.
$ awk -f tst.awk file
ipAddr,dash1,dash2,dateTime,getCmd,number,info,browser
24.240.97.38,-,-,09/Feb/2015:07:38:23 -0600,GET /irep/client/Cart/Controller/TempController.js HTTP/1.1,304,webpage,Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML; like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4
24.240.97.38,-,-,09/Feb/2015:07:38:23 -0600,GET /irep/client/Libraries/jquery.mobile.datebox.js HTTP/1.1,304,webpage,Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML; like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4

web2py with MongoHQ deploy at openshift: RuntimeError: no driver available ('pymongo',)

I'm trying to deploy my app to openshift, but I got error message. Following are my logs:
==> app-root/logs/web2py.log <==
127.5.151.1, 2014-06-01 18:08:10, GET, /admin/static/images/questions.png, HTTP/1.1, 304, 0.010710
127.5.151.1, 2014-06-01 18:11:12, HEAD, /, HTTP/1.1, 303, 0.000809
127.5.151.1, 2014-06-01 18:11:13, HEAD, /, HTTP/1.1, 303, 0.004810
127.5.151.1, 2014-06-01 18:41:05, GET, /MarkIt/, HTTP/1.1, 500, 5.459672
127.5.151.1, 2014-06-01 18:49:36, GET, /MarkIt/, HTTP/1.1, 500, 5.658112
127.5.151.1, 2014-06-01 18:54:00, GET, /MarkIt/, HTTP/1.1, 500, 5.682422
127.5.151.1, 2014-06-01 19:10:50, HEAD, /, HTTP/1.1, 303, 0.000960
127.5.151.1, 2014-06-01 19:10:50, HEAD, /, HTTP/1.1, 303, 0.001024
127.5.151.1, 2014-06-01 19:56:22, GET, /MarkIt/, HTTP/1.1, 500, 5.487744
127.5.151.1, 2014-06-01 20:04:03, GET, /MarkIt/, HTTP/1.1, 500, 5.431559
==> app-root/logs/python.log <==
[Sun Jun 01 20:04:02 2014] [error] DEBUG: connect attempt 4, connection error:
[Sun Jun 01 20:04:02 2014] [error] Traceback (most recent call last):
[Sun Jun 01 20:04:02 2014] [error] File "/var/lib/openshift/538b85575973cad5cc000794/app-root/runtime/repo/libs/gluon/dal.py", line 7409, in __init__
[Sun Jun 01 20:04:02 2014] [error] self._adapter = ADAPTERS[self._dbname](**kwargs)
[Sun Jun 01 20:04:02 2014] [error] File "/var/lib/openshift/538b85575973cad5cc000794/app-root/runtime/repo/libs/gluon/dal.py", line 5240, in __init__
[Sun Jun 01 20:04:02 2014] [error] if do_connect: self.find_driver(adapter_args)
[Sun Jun 01 20:04:02 2014] [error] File "/var/lib/openshift/538b85575973cad5cc000794/app-root/runtime/repo/libs/gluon/dal.py", line 746, in find_driver
[Sun Jun 01 20:04:02 2014] [error] raise RuntimeError("no driver available %s" % str(self.drivers))
[Sun Jun 01 20:04:02 2014] [error] RuntimeError: no driver available ('pymongo',)
97.77.53.27 - - [01/Jun/2014:20:03:56 -0400] "GET /MarkIt/ HTTP/1.1" 500 843 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14"
I'm using MongoHQ, the app runs totally fine if I run it locally.
The way I connect to MongoHQ is in db.py:
if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
#db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
db = DAL("mongodb://username:password#oceanic.mongohq.com:10017/MarkIt",
check_reserved=["mongodb_nonreserved",], adapter_args={"safe":False})
Only one of my applications in web2py uses MongoHQ and that's the one I could not open. Other work fine.
I think it might be dependency issue but I don't know how to resolve it.
I also did rhc cartridge add mongodb-2.4 -a my app but it does not help.

Gzip html files shows weird chars in chrome

using gzip on my php output like this
if( isset($compression['html']) && $compression['html'] == TRUE)
{
ob_start("ob_gzhandler");
header("cache-control: must-revalidate");
header("expires: ".gmdate('D, d M Y H:i:s', time() + $compression['expire'])." GMT");
}
produces the error show in the image below. It works fine in FF and Safari, but in chrome it does not. Any idea how to solve it?
This is the header I get
Request URL:http://www:8888/formandsystem/gzo/de/dashboard
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,de;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Cookie:ci_session=kyK5%2BhpX3N6dE7v9IoZtDzNRWT8rheDQATYZ7ztAoaAhbubmwfk2eScdjoZl0Bzwfi89YSPmwERE6NZ24t%2BCCgq4ImtYsJl12Fv%2B2GmmmA%2FPiOlxULO7cBx%2B%2BMFzbLtENeENHjBc16Oxg456Nykd6AGVUe1Kjc3u0c44xyOMVB1ZVrbBXEeujoLlaxUsDl2VJE8BvkqhqvD6DjgblNnKuTT1IvJ2VONduY2tqSk0Ldo6agsdEm0hIpILjTAEGSOqPETkXHA%2FWOGR1rH0f2M4C7ARhg14Vw%2BETIuMy5I4E14OU9FZAMZBmgXj%2FlbwG4v7Pfpq3vGCGF9LJHbtyUy9JBaucjz4s34jE36XLC3Mb2f5NNHhoTjAuLlpO%2FLKrYEutjxaXjMxId4BBWQEbIaKVFaWU5f6HZ671X2lTucUXE%2BHcyjxeGXa10bYygICJu%2BfcCU54k9LJoRB%2BCPR4SIdKQ%3D%3D
Host:www:8888
Referer:http://www:8888/formandsystem/gzo/de/dashboard
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11
Response Headersview source
Cache-Control:no-cache, must-revalidate
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:1855
Content-Type:text/html;charset=utf-8
Date:Fri, 09 Mar 2012 00:07:29 GMT
Expires:Fri, 09 Mar 2012 01:07:29 GMT
Keep-Alive:timeout=15, max=100
Pragma:no-cache
Server:Apache
Vary:Accept-Encoding
X-Powered-By:PHP/5.2.13
Thanks