apache - additional mysql-installation without root - php

got some space at an intern SUSE Linux Enterprise Server 11 (x86_64) for the apache-webserver (apache 2.2.29, php 5.4.40) of our department.
Our php is built with Oracle, not MySQL. I wanna install MySQL additionally but due to our very strict guidelines I only have permissions to write in my "/usd/[user]"-directory, not "/var/lib" etc. so there is no possibility to run the command "rpm -i MySQL-server-5.6.25-1.sles11.x86_64.rpm" or sth like that.
user:/usd/as07100a/soft> rpm -i MySQL-server*
error: can't create transaction lock on /var/lib/rpm/__db.000
user:/usd/as07100a/soft> touch /var/lib/rpm/__db.000
touch: cannot touch `/var/lib/rpm/__db.000': Permission denied
Is there any known option I can install MySQL with my restricted permissions (e. g. kinda portable version)?

It seems that this is possible:
Install MySql without root access
Also see this post for additional configuration information: Mysql - specify socket location
You will also likely need to change the port number in your configuration since OracleSQL is probably running on that port already. You can use netstat to see if any other program is listening on 3306.
netstat -ntl

Related

Running Rscript from within PHP: cannot load shared libraries

I am trying to run R code from within PHP. I am using RHEL 7.4.
However, because Apache runs as a different user than installed the R packages, it cannot load packages:
My PHP code has this line:
echo shell_exec("(Rscript -e 'library(lme4, lib.loc = \"/var/www/R/lib\")')2>&1");
which produces this error in the browser:
Error: package or namespace load failed for 'lme4' in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/var/www/R/lib/Rcpp/libs/Rcpp.so':
/var/www/R/lib/Rcpp/libs/Rcpp.so: failed to map segment from shared object: Permission denied
Execution halted
The file /var/www/R/lib/Rcpp/libs/Rcpp.so has permissions 775, so I don't think the permissions are actually the problem.
How can I tell Apache / PHP where to look for the shared libraries?
The server is not public-facing, so I would take any solution from properly accessing the shared library, to giving user apache sudo access with NOPASSWD to run as my user (or something similarly reckless, since that didn't actually work...).
Thank you!
This appears due in part to an SELinux setting in Red Hat. I'm not entirely sure whether this is Red Hat-centric, or specific to the configuration at my university (who installed Red Hat in the first place).
Originally:
$ getenforce
Enforcing
Fix:
$ sudo setenforce 0
$ getenforce
Permissive
Persistent fix: modify /etc/selinux/config to have the line
SELINUX=Permissive
Credit to this StackOverflow thread.

Drush command(s) run on Drupal 6 sites, but not Drupal 7?

I am running into an issue with a customer's Drupal sites. He has a number of D6 installs, and a new D7 that he's just starting on. All of these sites are on the same shared hosting package.
The problem is when running certain drush commands only on the D7 site. There are no issues on the D6 sites. The specific error for drush up on the D7 site follows:
foo#bar [~/www/foo]# drush up
Command pm-update needs a higher bootstrap level to run - you will need to invoke drush [error]
from a more functional Drupal environment to run this command.
Command pm-update needs the following modules installed/enabled to run: update. [error]
The drush command 'up' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a configured database. In
this case you can select another site with a working database setup by specifying the URI
to use with the --uri parameter on the command line. See `drush topic docs-aliases` for
details.
* connect the database through a socket. The socket file may be wrong or the php-cli may
have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.
Drush was attempting to connect to:
Drupal version : 7.28
Site URI : http://default
Database driver : mysql
Database username : username_foo
Database name : database_foo
PHP configuration :
PHP OS : Linux
Drush version : 7.0-dev
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
Drupal root : /home/foo/www/foo
Site path : sites/default
Everything I can find (and indeed the link in the error message) say the solution is to change the host value in the settings.php file from localhost to 127.0.0.1. However, this has not been the solution for us.
The frontend site has no problems connecting to the database, and drush itself seemingly does in many cases too.
drush sql-connect will generate a string that you can use to connect to MySQL.
drush sql-cli will successfully connect to MySQL
The settings.php file is definitely in a folder called default (path: www/foo/sites/default) and I get the exact same error when specifying --root and --uri options.
Drush was originally a ~5.x release, and it had the same issues. We updated to the ~7.x to try to eliminate the error. The host value in settings.php has been localhost as well as 127.0.0.1 with equally poor results.
We've verified that MySQL is available via socket from the PHP CLI. Drush is up to date and a fresh install. The Drupal 7 site is a brand new fresh install.
I'm at a loss. Why would this work with the D6 sites, but not the D7? Any suggestions?
Is your settings.php file in a folder called 'default'? If not, you might need to tell Drush where to find it by using --uri=mysite.com or -l mysite.com.
There are several ways to specify which Drupal site Drush will target. The most basic option is fairly verbose; run:
$ drush --root=/path/to/drupal --uri=http://example.com status
You can do the same thing with a slightly different syntax:
$ drush /path/to/drupal#example.com status
You can also specify the Drupal site implicitly, by setting the cwd to the folder that contains the settings.php file for your site:
cd /path/to/drupal/sites/default # or /path/to/drupal/sites/mysite.com, as appropriate
$ drush status
In all of the cases above, if settings.php is in a folder called "default", then you do not need to specify the --uri component; you may, for example, cd /path/to/drupal followed by drush status, and the correct Drupal site will be found. If settings.php is not in a folder named 'default', then you will need to either specify --uri, or cd to the folder that contains the settings.php file.
Source
According to this message:
pm-update needs the following modules installed/enabled to run: update
Drush requires Update module to be enabled, so the following command should fix the problem:
drush -y en update

MySQL Database won't start in XAMPP Manager-osx

I downloaded XAMPP about a month ago and it was working just fine. Today I installed a voice recognition software and then restarted my computer. Ever since, MySQL won't start in my manager-osx application. It doesn't throw me an in the application log. This is what it says:
Stopping all servers...
Stopping Apache Web Server...
/Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh : httpd stopped
Stopping ProFTPD...
Checking syntax of configuration file
/Applications/XAMPP/xamppfiles/proftpd/scripts/ctl.sh : proftpd stopped
Restarting all servers...
Starting MySQL Database...
Starting Apache Web Server...
/Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh : httpd started
Starting ProFTPD...
Checking syntax of configuration file
/Applications/XAMPP/xamppfiles/proftpd/scripts/ctl.sh : proftpd started
Both my ProFTPD and my Apache Web Server are running. MySQL isn't.
When I go to phpmyadmin, it throws me this error message.
#2002 - No such file or directory
The server is not responding (or the local server's socket is not correctly configured).
Please help me. I have no idea what to do.
UPDATE:
After looking around the internet a bit, I found a similar problem a user had with MAMP, another user recommended killing the mysql process, what ever that means. Could this be a fix to my problem?
UPDATE 2:
I found the answer to my problem but I can't answer it yet. So here's the answer:
1) Open terminal and type
sudo su
and then put in your password
2) Then type
ps aux | grep mysql
(just copy and paste this)
3) You will need to get the process id of mysql. There should be number near the top, something like 739 or 8827
4) Kill the process using
kill -9 {process id}
this should look something like this: kill -9 739
5) Restart MySQL in manager-osx
This should work:
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
Minimal Guide
1.
sudo killall mysqld
2.
manager-osx > start mysql
If that didn't work...
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
Google the error...
Examples:
Error:
ERROR! The server quit without updating PID file (/Applications/XAMPP/xamppfiles/var/mysql/<computername>.local.pid)
My Solution:
In /Applications/XAMPP/xamppfiles/etc/my.cnf change user = <uid> s that <uid> is uid from id command.
$ id
uid=...
$ vim /Applications/XAMPP/xamppfiles/etc/my.cnf
...
If these commands don't work for you:
sudo killall mysqld
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
Try this:
For XAMPP 7.1.1-0, I changed the port number from 3306 to 3307.
Click on Manage Servers
Select MySQL Database
Click on Configure on your right
Change your port number to 3307
Click OK
Close your Control Panel and relaunch it.
You are now good to go.
check the err log on your /Applications/XAMPP/xamppfiles/var/mysql/ with filename like your_machine_name.local.err, if you find something like: "Attempted to open a previously opened tablespace. Previous tablespace ... uses space ID"
the following works for me:
edit file:
/Applications/XAMPP/xamppfiles/etc/my.cnf
find the [mysqld] section, add one line:
innodb_force_recovery = 1
then run
sudo /Applications/XAMPP/bin/mysql.server start
everything is ok again.
and then the last step:
edit the my.cnf again and remove the line you just added :
innodb_force_recovery = 1
and restart mysql again. Otherwise all your tables will be read only
Try running these two commands in the terminal:
sudo killall mysqld
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
For me the following worked: Change permission into 'read only' for 'everyone' to the file /Applications/XAMPP/xamppfiles/etc/my.cnf. Then start MySQL from XAMPP manager.
close XAMPP control
sudo killall mysqld
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
it happened to me. and
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
not work for me.
so, i reinstall the xampp, then fix it.
attention:
reinstall the xampp, will not delete mysql data, no need to worry about that.
I first couldn't manage to kill mysql daemon with the commands posted here. So I remembered my linux times and did the following:
I monitored the running processes by running top in one terminal window. Then I killed mysqld via sudo killall mysqld (screw the PID ;-) ) in another and restarted via sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start.
There's been a lot of answer, but I think I found what is causing it, at least for me. It looks like if you put your computer to sleep (or it falls asleep on its own), when it reopens, it tries to open the the mysql process again. At one point I looked at my activity monitor and I had 5 instances running - killing all of them and then starting mysql works.
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
This worked for me.
I had success with easy killing all active mysql processes in Monitor Activity tool:
1) close XAMPP control
2) open Monitor Activity
3) select filter for All processes (default is My processes)
4) search for: mysql
5) force quit all the mysql
6) relaunch XAMPP control and launch apache again
Enjoy
try these two line from terminal
sudo killall mysqld
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
on
macOs High Sierra
if mysql is not getting started from manager- oxs and have tried direct command i.e
sudo /Applications/XAMPP/bin/mysql.server start
too than
go to path edit
/Applications/XAMPP/xamppfiles/etc/
find file :
my.cnf
edit it
under the [mysqld] section, add following line:
innodb_force_recovery = 1
after it save and run or can be done from manager-osx
sudo /Applications/XAMPP/bin/mysql.server start
it should start the mysql.
once its run you need to again
edit the
my.cnf
file and remove the line just added
innodb_force_recovery = 1
stop and start mysql again. by command
sudo /Applications/XAMPP/bin/mysql.server start
or
by manager-osx
it will be working fine.
It can cause because of the software you installed or may be any other software which is using the same port 3306. This 3306 port is used by the Mysql in XAMPP. Similar kind of problem I faced for Apache. I was running skype and trying to run the XAMPP but the skype uses the same port as Apache so it was not working. Then I sign out from skype then the port was free and the apache started. So you should look for the software in you laptop which is blocking or making busy this port. Free that port by closing the software and then run XAMPP and It will work.
What I did was the following: In XAMPP Control Panel I edited the my.ini file of configuration of MySql and changed the port from 3306 to 3307 and it worked, hope it helped!
Edit: after you save this changes be sure that the service is off and then restart the service. I had this same problem when I installed MySQL, it's just the port.
I encountered this problem just now. I checked log file and found it is caused by the server was not shutdown correctly. So I found this http://rivenlinux.info/how-to-recover-innodb-corruption-for-mysql/ and add a simple configuration "innodb_force_recovery = 1" in [mysqld] in my.cnf. Then the problem was solved.
The log file is located /Applications/XAMPP/xamppfiles/var/mysql and it named accroding to your server name. Just link this XXX-MacBook-Pro.local.err
All the answers stated above in relation to changing the port number are in this situation the best way to solve this problem since you need your voice recognition software to coexist with MAMP. However, you must remember that changing this port number is going to affect all you subsequent connections to MySQL (i.e, terminal,php code,phpmyadmin,etc). Hence It would be advisable to change the port on which the voice recognition software runs. Hope this was helpful.
:)
if you are getting this error
.............ERROR! The server quit without updating PID file
Try this
Go to /Applications/XAMPP/xamppfiles/var/mysql/
if there is no file with the name Your_Username.local.pid
Your_Username should replace with your Mac Username
Create a file with this name
Then try
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
its worked for me
It had the same problem, all I did was give read-only permissions for ALL users (system included) and all items included in the following folders:
/Applications/XAMPP/xamppfiles/etc
/Applications/XAMPP/xamppfiles/sbin
and relaunch XAMPP control and launch mysql server again
or
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
I have same problem and get this error in hostname.err in directory /Applications/XAMPP/xamppfiles/var/mysql
2016-09-06 15:32:45 140735322399488 [Note] Plugin 'FEEDBACK' is
disabled. 2016-09-06 15:32:45 140735322399488 [Note] Heuristic crash
recovery mode 2016-09-06 15:32:45 140735322399488 [Note] Please
restart mysqld without --tc-heuristic-recover 2016-09-06 15:32:45
140735322399488 [ERROR] Can't init tc log 2016-09-06 15:32:45
140735322399488 [ERROR] Aborting
2016-09-06 15:32:48 20004 mysqld_safe mysqld from pid file
/Applications/XAMPP/xamppfiles/var/mysql/hostname.pid ended
Then I removed tc.log and It works fine after restart mysql through manager-osx
This could be due to the fact that another instance of mysqd is already running in your mac-book-pro (MacOs-10). It's next to impossible to kill/pkill mysqld or ....I tried that route many times, with out any success. Finally the following worked for me :
launchctl unload -w /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
wait a few minutes and check with
ps -ef|grep mysqld
It should be gone!
It might be the possibility that your voice recognition software has a installer of mysql internally and when u installed this software, it has installed mysql too and added it to the service and this mysql service starts once your system starts. So now u r having two mysql servers (one from voice recognition software and second is from XAMPP) that's why killing the previous process (mysql service) solved your problem. But this is not a permanent solution, you have to repeat it every time when ever you start your machine. So better is to find out that mysql server (service) and change its port no. OR change settings so that mysql service should not start when your machine start (but might be your voice recognition software won't work properly)
I hope it will help you.
Cheers
You seem to have found a work-around by killing the process, but make sure you check for free space on your MySQL partition. If your logs or db files are consuming all your drive space, mysqld will not start.
Restarting the computer, or using the 'kill' commands listed above solve the problem. AS for preventing it from happening, I've found this occurring anytime my computer goes to sleep. The port is obviously kept reserved, and then on wake, mysql tries to reconnect to that port, but can't. This could be your problem also.
I am running XAMPP 5.6.3-0 for OS X Yosemite 10.10.2 and ran into the same issue twice, the first time was with Mavericks. With a bunch of different solutions to the issue with MySQL Database not starting using Manager App I wanted to confirm what had worked for me. The workaround that always worked and forced MySQL to start was by opening Terminal and using:
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
I had the Manager App open and started ProFTPD and Apache and then ran the sudo command.
The other suggestion by wishap that worked was to locate /Applications/XAMPP/xamppfiles/etc/my.cnf file and change the permissions for "everyone" to Read only.
The other problem I had that seems to be another issue with many solutions is the problem after everything is started then entering localhost which brings me to the xampp splash screen and then nothing. The only thing that worked for me, to at the very least, to access the phpMyAdmin page is by entering localhost/phpmyadmin
I hope this helps others reading through a bunch of threads for an answer.
Regards,
Erik
Try this, sudo service mysql stop it will stop any other mysql services and then restart xampp
Just Click on Managed Servers Tab in XAMPP MANAGER , Now select MySQL Database, Click on configure on right side.
Change port from 3306 to 3307 and it will work.
It had the same problem, all I did was give read-only permissions for all users and all items included in the following folders:
/Applications/XAMPP/xamppfiles/etc
/Applications/XAMPP/xamppfiles/sbin
Well, sometime there is just ERROR! message is shown in mysql comment on terminal.
Then, just reinstall (overwrite) XAMPP, then it can be solved.

Connecting to Oracle 11gR2 XE on Ubuntu 13 server via PHP

I am trying to connect to Oracle 11gR2 Xe on Ubuntu 13 server from another computer in the network, via PHP.
I am using installs and examples followed from oci_connect like here:
<?php
query_cities();
function query_cities() {
if {
$c = oci_connect("hr", "hr", "localhost:1521/XE");
;
} else {
echo "No connection"; }
?>
or another example like:
$c = oci_connect("hr", "hr", "192.168.1.33:1521/XE");
I have already enabled the remote connection in DB via SqlPlus
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
and i have unlocked the user HR
SQL> ALTER USER hr ACCOUNT UNLOCK;
but I can only find some connection via IPv6 on the network from SQL Developer, like netstat:
tcp6 0 0 192.168.1.33:1521 192.168.1.2:57563 ESTABLISHED 14843/oracleXE
tcp6 0 0 192.168.1.33:1521 192.168.1.2:59314 ESTABLISHED 15665/oracleXE
not from my browser and they are not on tcp IPv4. The browser window remain white .. no reaction, unresponsive and no error message.
Should this be due to the TNSLR IP is active only on IPv6 or non of the oci_connect formulas are good enough or I am missing some other else?
I would appreciate any help on this issues
Alright, on the basis of received advice to seek the error in logs, I've found the message "*There is something wrong with your system - please check that ORACLE_HOME and LD_LIBRARY_PATH are set and point to the right directories*" and I decided to go through the sophisticated process of installing the Oracle InstantClient and reinstall OCI8 package, after the model from st-curriculum.oracle - with very small modifications, as follows:
Oracle 11g R2 XE database and Apache2 / PHP server have been apriori installed on Ubuntu 13.10 server and system prepared (with prereqiuzite, swap file, kernel parameters, memory leak error recover, libraries and chkconfig emulator), as described in many posts.
I stopped apache2 server
service apache2 stop
and started DRCP connection pooling as in st-curriculum.oracle.com
I created a user named PHPHOL (and alternate install Oracle's sample HR schema, if not already done at oracle install)
Next I downloaded the Basic and the SDK Instant Client packages from OTN: oracle.com/technetwork/database/features/instant-client/index-100365.html and unzipped the packages in $ORACLE_HOME, (/u01/app/oracle/product/11.2.0/xe)
Then I downloaded the OCI8 packeage from pecl.php.net/package/oci8 and installed in /opt/oci8 as instantclient
phpise
./configure --with-oci8=instantclient,/u01/app/oracle/product/11.2.0/xe/instantclient_11_2
make / make install
I set the oracle environment path as in oracle technote
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/instantclient_11_2
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH=/opt/oci8/modules
nano /etc/ld.so.conf.d/oracle.conf
and insert: /u01/app/oracle/product/11.2.0/xe/instantclient_11_2
nano /etc/ld.so.conf.d/oci8.conf
and insert: /opt/oci8/modules
nano /etc/ld.so.conf.d/shared.conf
and insert the installed shared extensions location: /usr/lib/php5/20121212
ldconfig
Next I edited the configuration file php.ini to add: extension=oci8.so, set the date.timezone directive and added also the OCI8 1.4 extension class: oci8.connection_class = MYPHPAPP (for the st-curriculum.oracle.com examples, see link above)
I made the link: $ORACLE_HOME/instantclient_11_2/libclntsh.so.11.1. to points to $ORACLE_HOME/instantclient_11_2/libclntsh.so
Restart Oracle database and Apache services on Ubuntu 13.10 server
/etc/init.d/oracle-xe force-reload
service apache2 start
I verified in phpinfo() the oci8 was enabled, and I made the connect.php file like:
$conn = oci_connect("hr", "hr", "localhost/xe");
or like the one from st-curriculum.oracle.com example.
From another computer on the same network I connected through a browser to oracle database on Ubuntu server and I've got
Connected to Oracle!
I hope this help

How to connect to the proper MySQL database on OS X? (Two mysqld instances running)

I have two instances of MySQL server running on my machine. One is the mysql package that came bundled with MAMP, and the other is a 64 bit installation that I downloaded so I could work with a python library of mine.
This is strictly for development.
Both are running:
:~ zachary$ ps -awwx | grep mysql
1944 ?? 0:00.02 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/MyMachine-2.local.pid
2016 ?? 0:10.17 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/MyMachine-2.local.err --pid-file=/usr/local/mysql/data/MyMachine-2.local.pid
6824 ?? 0:00.02 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log
6894 ?? 0:00.36 /Applications/MAMP/Library/libexec/mysqld --basedir=/Applications/MAMP/Library --datadir=/Applications/MAMP/db/mysql --user=mysql --lower_case_table_names=0 --log-error=/Applications/MAMP/logs/mysql_error_log.err --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --socket=/Applications/MAMP/tmp/mysql/mysql.sock --port=8889
Yet my PHP only seems to want to be able to connect to MAMP's MySQL server. I believe that mysql_connect() lets you specify a port but I'm not sure how to deal with this.
Thanks.
Edit: it seems that MAMP has a preference for its own MySQL server when you use mysql_connect() on a MAMP installation -- not sure why -- can anyone please explain? But I was able to connect to my manually installed MySQL server using this syntax:
mysql_connect(':/tmp/mysql.sock', 'username', 'pw');
It looks like MAMP is running on port 8889 and the other instance is on the default port (3306). To be sure, run netstat -lnp to see what ports all listening processes are using. (Warning: double check the options to netstat, as I am a Linux user, not a Mac user).
AJ right.
And to connect to MySQL server on specific port (other than 3306)
mysql_connect("{$mysqlServerNameOrIp}:{$mysqlSpecificServerPort}", 'username', 'password');

Categories