I am working on mac with sierra. I have recently installed apache, php, mysql and phpadmin. I followed this instruction: https://medium.com/#JohnFoderaro/how-to-set-up-apache-in-macos-sierra-10-12-bca5a5dfffba#.jraxx6f9f to instal apache php and to configur virtual hosts and this one: https://www.youtube.com/watch?v=b_6g_5S_bVo&t=183s to instal mysql and phpadmin.
I put my website (html + php) on apache server, all data is stored in /Library/Sites/foo/, I can access it via localhost and everything works fine.
I have my phpmyadmin folder in Library/WebServer/Documents/.
After starting mysql and visiting localhost/phpmyadmin/ or localhost/phpmyadmin/setup/ or localhost/phpmyadmin/config/ I am still getting page 404 Not Found.
I have visited many website with similar cases but I can not work it out.
localhost/phpmyadmin giving page not found error,
Localhost or phpMyAdmin not found on server: How to fix?
In my case /etc/apache2/apache2.conf is empty and adding "Include /etc/phpmyadmin/apache.conf" isn't working, moreover adding it to /etc/apache2/httpd.conf gives error. I have read that it might by coused because apache server is working and it is impossible to use phpadmin and apache on the same time on the same place is it true? After stopping apache phpadmin doen't work as well.
What am I doing wrong?
Hope this will help you to get through this.
After Configuring apache you need to follow these steps to get connect with local MySQL.
Download the "Mac OS X 10.12 (x86, 64-bit), DMG Archive" - dmg version from https://dev.mysql.com/downloads/mysql/5.7.html and install the mysql in your mac machine. At end of the installation root password will be generated. kindly copy that password into notes or other files
In terminal follow these steps (PURE OPTIONAL)
"cd /usr/local/mysql/bin" click enter button
"sudo ./mysql -u root -p" click enter and terminal will ask for
password and you need to copy paste the MySQL ROOT password which i
mentioned the step 1 and enter.
now you will be into mysql and if you want to change the ROOT
password then enter this command in terminal "Alter user
'root'#'localhost' identified by 'your new password which you like
to change';" enter and exit from terminal
Download phpmyadmin from https://www.phpmyadmin.net/ and extract the phpmyadmin file and rename it as phpMyAdmininto your WebServer/Documents folder ( /Library/WebServer/Documents/)
Go to Terminal and enter the following command
cd /Library/WebServer/Documents/ and click enter
cd phpMyAdmin and click enter
sudo mkdir config and click enter
sudo chmod o+x config and click enter
Go to Browser URL and enter the following localhost/phpmyadmin/setup and server set up page will be open and follow the below steps
Click on New Server button then navigate to authentication tab
and enter the ROOT PASSWORD & click apply button
At bottom of overview page you can find Download button and click
that and config.inc.php file will be downloaded
copy paste the config.inc.php file inside your phpMyAdmin
folder
Go to your browser url then enter localhost/phpmyadmin/ and enter with your credentials into database
Ok I have solved it. It was because I didn't create a virtual host and hostname for phpmyadmin.
This is how I made it:
1.Use sudo nano /etc/apache2/extra/httpd-vhosts.conf to create virtual host for phpmyadmin I tried:
<VirtualHost *:80>
DocumentRoot "/Users/piotrek/Sites/phpmyadmin"
ServerName phpmyadmin.localhost
ErrorLog "/private/var/log/apache2/phpmyadmin-error_log"
CustomLog "/private/var/log/apache2/phpmyadmin-access_log" common
</VirtualHost>
Go to sudo nano /etc/hosts to create hostname entries. I tried:
127.0.0.1 phpmyadmin.localhost
Restart apache sudo apachectl restart
Put phpmyadmin file into Sites
Everything works fine, I can create new database and work with it :)
Related
Just installed xampp and started all services including Apache but still somehow cannot connect to my localhost server still when i write the address 127.0.0.1 it shows that message that it works.
Someone with an idea whats happening
Are you using Windows or Linux (eg., Ubuntu, Debian, Fedora, etc.)?
If you are using Windows 7/8/10, it should work without this steps, but do the following if not working with these Operating Systems:
1) Press Win+R
2) Type notepad, and then press Ctrl+Shift+Enter
3) Click on File, click Open, go to C:\Windows\System32\drivers\etc and click on the hosts file.
4) Add the following (if not exists) at the end of the file or the start of the file:
127.0.0.1 localhost
5) Click Save, and it should work without any restart.
If you are using Linux, do the following:
1) Open the Terminal, type nano /etc/hosts
2) Add the following (if not exists):
127.0.0.1 localhost
3) Now, press Ctrl+X, and press Enter
The above should solve your problem, but if not, please let me know.
After reading the installation guide for program-o http://blog.program-o.com/documentation-v2/installation/ I was wondering how I would go about doing step 2 locally and installing it without hosting an online server?
Just put your code in htdocs directory (inside xampp instalation directory).
Then You will be able to execute your code by typing 'localhost' in your browser.
Or if you want to use other domain instead of localhost, You have to edit your hosts file.
In Windows7 hosts file is located in:
%systemroot%\system32\drivers\etc
My hosts file for example:
127.0.0.1 domain.com
I can access my code by typing for example 'domain.com' instead of 'localhost'
I use wamp2.2 for all the time, but i had to install xamp1.6.8 cause i've got to work with project created for old php version. Xamp installation goes fine but when i run it i cant get localhost site. Ive got blank page with favicon of wamp and comunicate that site is unavaible. I know that this is configuration case. Anybody know how to fix this?
I want to run only one of them at once, and i have configured some virtualhosts for wamp they dont have to be accesible while xamp is running i need xamp only for one project.
for run xampp and wamp in same computer you can use this tutorial from arasjoomla website: http://arasjoomla.ir/joomla-tutorial/how-to-run-xampp-and-wamp-on-same-computer
for example we used wamp with default port and setting and set changed in xampp:
Change xampp apache port 80 to example 8080 in httpd.conf from
directory C:\xampp\apache\conf
In my.ini from C:\xampp\mysql\bin change port=3306 to port=3307
In config.inc.php from C:\xampp\phpMyAdmin after this code:
$cfg['Servers'][$i]['AllowNoPassword'] = true;
add this code:
$cfg['Servers'][$i]['port'] = '3307';
restart xampp now we cab use xampp and wamp for example use this
code in xampp port 3307 for connection database:
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "my_db";
$port = '3307';
$conn = mysqli_connect($servername, $username, $password, $dbname,$port);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT id, name FROM users";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo "id: " . $row["id"]. " - Name: " . $row["name"]. "<br>";
}
} else
echo "0 results";
mysqli_close($conn);
WAMP and XAMPP are basically the same thing i.e. Apache MySQL and PHP so if one is running it's Apache will have captured port 80, so the second one wont be able to get to port 80, ditto one's MySQL server will have captured port 3306 so the others wont run.
Why do you need to install XAMPP to get an old version of PHP running, WAMPServer is designed to allow you to switch between multiple versions of Apache/MySQL and PHP fairly easily.
But now you have done it, just make sure that the Apache and MySQL services from XAMPP are set to start manually and also Wampservers [wampapache] and [wampmysqld] services as well. then just run only one of them at any one time.
I have two working together, first was wamp. So xampp has to be changed at:
httpd.conf :
Listen 8080
ServerName localhost:8080
httpd-ssl.conf :
Listen 4433
<VirtualHost _default_:4433>www.example.com:4433
By the way, I realised so xampp has much better, mean faster, refreshing time.
The chances are that they are both trying to run on the same port via localhost.
I think it will be difficult to run both at the same time, there's a much better way to this using a tool called "Vagrant".
Vagrant allows you to start up a virtual host that you have full control over, including PHP version. You can see more information about Vagrant at http://www.vagrantup.com/. This tutorial is what helped me get set up and understand how it works: http://code.tutsplus.com/tutorials/vagrant-what-why-and-how--net-26500.
Good luck!
If you want to run both XAMPP and WAMP together on the same machine but access only one of the servers at a time then you could go ahead installing both of them one after another. But, keep in mind that before installing the other server you have to completely stop all the services running from the XAMPP or WAMP control panel then quit the application. After this step you can go ahead installing the other server without changing any configurations or port numbers. This is because in this case we assumed that only one of the servers would be accessed at a time. Hence, before launching the other server one has to completely quit the application that is running currently by stopping all of it's services. If skype is installed then one has to change the default incoming connection ports to other than port 80 and 443.
If you messed up changing ports and config files then you could end up with the following error while trying to access phpmyadmin from XAMPP control panel:
**mysql said: Cannot connect: invalid settings. xampp**
note: while launching the servers , run it as administrator else some services will not start properly.
I TRIED INSTALLING BOTH XAMPP AND WAMP ON WINDOWS 10 AS SUCH AS
POINTED BY MANY THREADS I CHANGED THE DEFAULT PORTS FOR MYSQL & APACHE
XAMPP AS IT WOULD CONFLICT WITH WAMP ALREADY INSTALLED ONLY ENDING UP
UNABLE TO ACCESS PHPMYADMIN FROM XAMPP CONTROL PANEL. THEN REINSTALLED
XAMPP WITHOUT CHANGING ANY CONFIGS OR PORTS. STOP THE WAMP SERVICES,
QUIT THE APP AND THEN LAUNCH PHPMYADMIN FROM XAMPP CONTROL PANEL. AT
LAST IT WORKED!. THE PROCESS LOOKS SHORT THOUGH WHEN IN REALITY IT
TOOK ME COUNTLESS HOURS AND PAIN RESEARCHING ON THE WEB AND TESTING
FOR A POSSIBLE SOLUTION UNTILL I CAME UP WITH THIS.
Hopes, this quick tips and guides would be helpful.
If you guys wanna use MYSQL specifically on Both Wamp and Xampp . Yes It's possible. Not only that You can use the Apache server and all the components of it parallely. Let's say you need two different versions of MYSQL on a same machine then this solution that I am gonna tell you will be helpful.
First Install WAMP server and then after launching it Just go down to the bottom right of ur desktop and hit on the wamp server icon. You will be able to see All the components there. Now if you hit on MYSQL specifically then you'll see a my.ini file pointed there. Now open that file on a notepad and then search for "port" and replace the existing port of mysql which is 3306 to a new random port let's say 3360.
Now after this just press on restart all the services It's done.
Now Install xampp server and now go to xamp folder and search for mysql and rename that to mysql_old. Create a new and empty mysql folder now. Now redirect to the below link https://dev.mysql.com/downloads/mysql/5.5.html?os=3&version=5 and download the zip and extract it. After extracting it just paste all the contents of it in the newly created mysql folder. Now redirect to the bin path inside newly created mysql folder and create a new my.ini file. Over there just paste the below contents:
[mysqld]
# Set basedir to your installation path
basedir=C:/xampp/mysql
port=3306
key_buffer_size = 256M
# Set datadir to the location of your data directory
datadir=C:/xampp/mysql/data
# Default: 128 MB
# New: 1024 MB
innodb_buffer_pool_size = 1024M
# Default since MySQL 8: caching_sha2_password
default_authentication_plugin=mysql_native_password
[client]
ssl-mode=DISABLED
port=3306 #This port can be again anything..
Now after this just redirect to bin folder and hit on mysql d --initialize.
And then you're good to run mysql server on xamp using the following command
mysql -u root -p -h localhost.
This can help u run mysql on a different port.
Cheers
Maybe it is not a right channel to ask this question but I donot know where to ask.
I want to know how to run html file with apache on my ubuntu. I have written program with javascript and a html file and I want to run it via apache. I could not find htdocs folder in to copy my files there beside that I do not have permission to do that in ubuntu. My apache is installed in /usr/share/apache2.
When I write http://localhost it says:
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
but I do not know where to add the contents.
any help.
The default folder that it serves the HTML files from is /var/www.
For example, /var/www/test.html would be http://localhost/test.html.
In my case where I have installed and running the Apache 2 and if I type localhost/ into the browser it opens the Apache 2 Ubuntu default Page.
Now what I did was:
Suppose your HTML webpage Demo.html is located in the Website directory then copy the HTML page using one of the commands:
:~$ cp ~/Website/Demo.html /var/www/html
If this command does not work then try with the following command:
:~$ sudo cp ~/Website/Demo.html /var/www/html
And then open your browser and type this the browser search bar:
localhost/Demo.html
It will open the copied Demo.html.
Also if you want to access this hosted webpage from the outside of the machine where Apache 2 is running then use it's external IP address instead of localhost as follows:
ExternalIP/Demo.html
I am attempting to edit the "default" file located at ..
"/etc/apache2/sites-available/default"
on my Ubuntu machine running Apache 2.2.8.
I want to do this in order to enable the use of .htaccess files. I have downloaded the "default" file and edited it and now I am trying to upload it back to the server via SFTP. I keep getting permission denied errors.
Could it be because Apache is running and making use of the file? I am an admin on the machine so I would expect to be able to overwrite the file. Thanks for any assistance.
No it does not need to be stopped.
Try accessing the file through ssh, and make sure you access it with root privileges:
sudo nano /etc/apache2/sites-available/default
You would still need to force-reload Apache after changing the config files, as tux21b suggested in a comment below:
sudo /etc/init.d/apache2 force-reload
For Apache/2.4.7 , the file that you want to edit is:
/etc/apache2/apache2.conf