[R-sig-Debian] php and RMySQL produces R crash

Christoph Knapp c.knapp at auckland.ac.nz
Fri Jan 27 04:34:12 CET 2012


I solved the problem,
R studio was installing libraries in places which were not visible for some reason when R was started from php. I just reinstalled (I had tried that before)  RMySQL at a the right place and it works now.

Christoph
________________________________________
From: r-sig-debian-bounces at r-project.org [r-sig-debian-bounces at r-project.org] on behalf of Christoph Knapp [c.knapp at auckland.ac.nz]
Sent: Friday, January 27, 2012 13:21
To: r-sig-debian at r-project.org
Subject: [R-sig-Debian] php and RMySQL produces R crash

Hi all,
I have a very strange problem with the RMySql package. I'm running linux ubuntu 64 bit and R 2.14. I'm trying to solve this now for a week and could not find anything helpful on the net.

Now the problem

If I start my R script from php (script attached) the output is as followed

Start R Script from php

R version 2.14.1 (2011-12-22)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> print(try(library(RMySQL)))
[1] "Error in library(RMySQL) : there is no package called 'RMySQL'\n"
attr(,"class")
[1] "try-error"
attr(,"condition")

> cat("running R script\n")
running R script

It fails to load the library RMySQL.

if I start my R script from terminal with the same command used in php

christoph at dell-desktop:~/Desktop$ R -f "reproduceProblem.R"

R version 2.14.1 (2011-12-22)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> print(try(library(RMySQL)))
Loading required package: DBI
[1] "RMySQL"    "DBI"       "stats"     "graphics"  "grDevices" "utils"
[7] "datasets"  "methods"   "base"
> cat("running R script\n")
running R script
>

it works

If I use require instead of library it returns FALSE and R crashes when the database connection is made and the code also loads the DBI package. I assume this is because RMySQL is never loaded but DBI.

Any ideas why R can not load RMySQL when started from a php script but otherwise there is no problem?

I attached two small scripts which reproduce the problem for me.

Any help is much appreciated.

Christoph



More information about the R-SIG-Debian mailing list