Stuck using terminal while trying to configure MySql and Php - php

I am currently following a tutorial on lynda.com which is explaining how to set up php and my sql using apache.
I now have a major issue that i can not seem to get around. Somewhere in the process of copying the tutorial i have entered something wrong and it wont let me type any normal commands.
When i load up terminal this appears:
Last login: Sat Sep 16 00:20:47 on ttys000
-bash: export: `/usr/local/mysql/bin: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin': not a valid identifier
-bash: touch: No such file or directory
Tom$
Previously i was entering commands like this:
Tom$ sudo apachectl configtest
Tom$ sudo nano httpd.conf
Everything worked and seemed fine, but i now appear to be stuck in this bash thing that i don't quite understand and each time i type anything it says "no such file or directory". Is there anyway i can get this back to normal? I have tried a number of things but nothing seems to work.
I hope this has been clear and any help this this topic would be much appreciated!

Related

XAMPP will not start Apache and MySql servers

Here is what the control panel looks like
But the output over here seems like it's working??
So far I've tried a whole bunch of terminal commands to force it to start and none of them have worked so far. Then I tried reinstalling but the same problem. I tried changing the port but that didn't work either.
When I run php files in the htdocs folder it works fine though, but phpMyAdmin doesn't connect.
This is error I get when trying to connect to phpMyAdmin
Having just spent hours on this problem, the following answer helped me:
"If the problem is not a busy port you can also try the following: select "show debug information" in the XAMPP config panel. you will find this option in config panel enable this option and click save it will display the files that are being executed, like when starting Apache you'll be shown something like "Executing "c:\xampp\apache\bin\httpd.exe". If you run the same command in cmd prompt it will clearly display the error with file name and line number.
All you need to do is to find the respective file dig in the code and resolve it.Your problem will be [may be] solved."

XAMPP manager can't start server on OS X but it work on terminal

First my english might be bad so if you understand what I mean but the sentence is not correct feel free to edit my post, and if you don't understand I'll try my best to explain better.
I installed XAMMP on my MyBook Air version 10.11.5. I can launch the application but in "Manage servers" when I press the "Start all" button all the status switched from "Stopped" to "Starting" and then return to "Stopped" after about 20 seconds. Here is the application log :
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
Two things here : the MySQL database doesn't send anything in return and it seem that for the log the servers are running. So maybe it was only a display problem on the "Manage servers" tab so I tried to go to the adress http://localhost but nothing.
After a lot of research and try the only topic who gives me what I want is this one : MySQL Database won't start in XAMPP Manager-osx
The command sudo /Applications/XAMPP/xamppfiles/bin/mysql.server startworks perfectly. So now I can start the MySQL server only. The I noticed something, here is the terminal log :
MacBook-Air:~ user$ sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
Starting MySQL
. SUCCESS!
You can see I had to enter my session password. So my questions are simple :
Could the password be the problem for the XAMPP Manager ?
i.e. the manager try to launch the servers but encounter the password request and then failed to launch the servers.
If it's the case how can I give to XAMPP the access so the manager can launch on is own the servers without needed to use the terminal ?
Is there any command like the one below to launch also the PHP server if I can't fix the Manager problem ?
I promise I did research on this topic but I find nothing about this specific password (I was often redirected on starting session password...).
Thank you for reading and maybe for answering !
Yes because thats not the right way to start XAMPP.
You should do the following instead cd to your xampp application folder, there should be a executable file called xampp. The gui application is not that good, I've had various problems with it, I think the best thing to do is to start it via terminal.
The password is not the problem, its asking because it requires admin privileges to run it. Thats why you're using sudo.
Run the following command:
sudo ./xampp start
You can find the list of all xampp terminal commands by typing the following:
./xampp -h
For example you can start different 'modules' of the application separately e.g to start just apache.
sudo ./xampp startapache
I hope this helps.
Could it be something broken with the installer?
I had the same issue, but after downgrading to 7.0.5 everything works fine on El Capitan.

ubuntu: .run file does not work at all

hey I've got a strange problem, I've read plenty of articles about it on the net and still have no clue what am I doing wrong. Here it goes: I want to build php projects on ubuntu so I got netbeans and wanted to install xampp. I downloaded xamp installer (extension .run) and it doesn't work at all, I mean I tried via terminal and also graphical mode- still nothing. I just run it as it's supposed 2 b run and nothing happens. So I typed in the terminal the following:
strace ./<xampp_installer_name>.run
and I got something like lot of lines but only this one seems 2 contain some error:
open("/lib/ld-linux.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
_exit(127)
Does anyone have any idea what I missed or I am doing wrong with this...? It took a day of my life and I'm out so I'd appreciate any ideas.
peace
You might need the 64 bit version of the xampp installer.
For anyone else who has this problem, rconxs's solution worked for me. If you're new to Ubuntu, you can check if you'll need the 64 bit version by going to System Settings > Details. On the overview page, check to see if the "OS type" is 64 bit. If so, be sure to download the 64 bit installer (should have a file name similar to: xampp-linux-x64-1.8.3-2-installer.run). Then, just follow the rest of the instructions on the apache friends site.

run shell script from php

I am attempting to create a php script that can connect thru ssh to my Qnap TS219 server and run a command on it.
My script so far connects fine to the server but when I run the command I get an error message and I can't figure it out.
exec.sh
#!/bin/bash
cp /share/MD0_DATA/Qdownload/rapidshare/admin/script.txt /share/MD0_DATA/Qdownload/rapidshare/admin/script.sh
chmod 755 /share/MD0_DATA/Qdownload/rapidshare/admin/script.sh
nohup sh /share/MD0_DATA/Qdownload/rapidshare/admin/script.sh &
exit 0
script.sh
#!/bin/bash
/opt/bin/plowdown -o /share/MD0_DATA/Qdownload/rapidshare /share/MD0_DATA/Qdownload/rapidshare/admin/down.txt 2>/share/MD0_DATA/Qdownload/rapidshare/admin/output.txt
the command that I am currently running thru ssh after I submit the form:
echo $ssh->exec('sh /share/MD0_DATA/Qdownload/rapidshare/admin/exec.sh');
Right now generates the code below but only after I kill 2 bash processes (the page keeps loading indefinetly and the processor activity is at 100% if I don't kill the 2 bash processes):
/share/MD0_DATA/.qpkg/Optware/share/plowshare/lib.sh: line 261: getopt: command not found start download (rapidshare): http://rapidshare.com/files/312885386/Free_Stuff-Your_Internet_eBay_Business_Free_Startup_Resources.rar /share/MD0_DATA/.qpkg/Optware/share/plowshare/lib.sh: line 261: getopt: command not found /share/MD0_DATA/.qpkg/Optware/share/plowshare/lib.sh: line 46: --insecure: command not found Error: failed inside rapidshare_download()
This script will be used in my local network, no access from outside, so I am not worry about security, I know the code looks very basic, primitive but I have no experience with php, shell script, so if someone can make any sense on this and help me out will be greatly appreciated.
Edit1. I also tried the shell_exec command still no joy and if I run the script thru putty works beautifully.
Edit2. I think we are on to something.
I added the code you suggested and I got the following message.
sh: /share/MD0_DATA/.qpkg/Optware/share/plowshare: is a directory /usr/bin:/bin:/usr/sbin:/sbin
I think at the moment the PATH is usr/bin:/bin:usr/sbin:/sbin and I think it should be /opt/bin /opt/sbin because there are the "executables". Any ideeas?
Thanks,
Chris.
Run this
echo $ssh->exec('pwd');
Does it list your path correctly? If so then your problem is NOT PHP, if it doesn't list or still gives an error then PHP is your problem and we can continue from there.
From the error you've listed, my first guess would be that PATH isn't set, so lib.sh can't find what it's looking for.
Remember you're logging in with a custom shell (PHP ssh), quite often things aren't set as they should be, so your scripts might not find requirements like paths and variables.
Edit:
Since it's giving /root, we at least know it's going through, why not also set the PATH etc...
echo $ssh->exec('PATH=$PATH;/share/MD0_DATA/.qpkg/Optware/share/plowshare; sh /share/MD0_DATA/Qdownload/rapidshare/admin/exec.sh');
Remember you can also use this to see what is and isn't being set.
echo $ssh->exec('ECHO $PATH');
I think I got it:
Following viper_sb logic, I changed the code to:
echo $ssh->exec('PATH=$PATH:/share/MD0_DATA/.qpkg/Optware/bin; sh /share/MD0_DATA/Qdownload/rapidshare/admin/exec.sh');
echo $ssh->exec('echo $PATH');
and magic, it worked ... I'll test it further, when I get home, but I think it worked, a file was downloaded in the /Qdownload/rapidshare folder ... hooray.

Cannot login with PhpMyAdmin on Mac os x 10.6. Does anyone know a fix to this error message?

I just reinstalled Mac Os X 10.6.2 and had to reinstall/update my MySQL server.
I run phpMyAdmin inside my localhost and I used to be able to login without a hitch.
Since the updated (latest version MySQL 5.1.45 & PMA 3.3.1) versions I only get the following error when trying to login with phpMyAdmin:
phpMyAdmin - Error
Cannot start session without errors, please check errors given in your PHP
and/or webserver log file and configure your PHP installation properly.
The only thing I noticed is that mcrypt cannot be loaded (this has always been the case, no idea what to do to install this..) but this has never been a problem before.
If anyone know what to do here that would be really appreciated.
Thanks for reading,
Jannis
PS: The MySQL server itself is running and I am able to login with as root user via the MySQL Administrator.app
Well setting log_errors to on would bring error messages to the web-server's error_log. To do so you can use an .htaccess file placed in your web root with
php_value log_errors = 1
in it. It can be not worked but there is some other ways too. You can edit your php.ini for example and restart your server after it.
Without error message it's hard to guess what is really happened. there can be something wrong with session save path or other settings
This happened to me when I changed my password from within PHPMyAdmin. The solution was simple. Clear the browser cache and try to login again. You should be good to go.
Old thread I know, but I've been struggling all day with this.
I'm on MacOSX Lion. Unfortunately, I've been struggling with the same issue all day. In my case however, I was not getting an errors in the php error_log. So I was clueless as to what was happening. I finally found a setting in phpMyAdmin's config.inc.php and used it like so:
$cfg['Error_Handler']['display'] = true;
After this I was able to see in the browser itself what the problem was with permissions on the folder specified in session.save_path (./tmp which is a symlink to /private/tmp on mac).
However, I'd like to add the setting a 777 to the session.save_path folder may not be the right thing to do. I have done the following which seems safer:
owner: root (default)
group: _www (sudo chgrp _www /private/tmp)
Then allow the group to read, write and execute using:
sudo chmod g+rwx /private/tmp
Prevent others from reading, writing or executing in this folder:
sudo chmod o-rwx /private/tmp
I too upgraded to 10.6, actually I got a new mac and migrated my system over, then I installed phpmyadmin 3.4.2 and was getting messages about not being able to login as well as message about needing mcrypt. I re-installed PHP, now I'm running PHP Version 5.3.6.
I had Navicat on my system and was able to log into mysql database without issue. I tried resetting my mysql password, but that would not take. Not sure why. I had no valuable data so I re-installed MySQL, now I'm running MYSQL 5.5.13.
Still I could not login with phpMyAdmin - however thanks to new MySQL I was no longer seeing message about needing encyption, but I was getting a #1045 error on phpmyadmin. I guess it was telling me I had wrong password. Actually I had never set a password! I guess phpMyAdmin didn't like that as it would not allow me to login without a pw. (as you can see from this post I am not well versed in linux/unix, but I am one persistent fellow! this took me three nights.)
I entered these in Terminal to set a password, then phpmyadmin worked!
1) Need to first stop the MYSQL server, enter this in Terminal, then hit enter:
/etc/rc.d/init.d/mysql stop
2) Then set a password or new password. Needless to say replace 'whatever…" with your password of choice by entering this line in Terminal, and hit enter.
UPDATE mysql.user SET Password=PASSWORD('whateverfornew') WHERE User='root';
3) Now flush the privileges by entering this line in Terminal, and hit enter:
FLUSH PRIVILEGES;
4) Now restart MySQL by entering this line in Terminal, and hit enter:
/etc/rc.d/init.d/mysql start
5) Now login to your phpmyadmin with username "root" and your new password.
Yep, I know this is rudimentary and I have no idea if I am following best practices but for those of us who are new to Mac / Unix and want to get phpmyadmin, mysql etc running this worked for me. Personally I found a lot of forums but most already assume that reader is comfortable using terminal and Unix commands…which I am not - I just wanted a working development zone.

Categories