How do I run my website files with Xampp? (error message) - php

I just got Xampp up and running and was able to run a simple 'hello world' php form. From there I copied all the files from my website (around 55mb) and tried to run index.php, but my web browser just displays, "Error establishing a database connection". The website itself is working, but just not in Xampp. As far as I know it's on one server (or at least I only had to use one ftp) and it is set up through WordPress. My website files consist of php, js, css, and html. Any ideas of what I should do or where the error might be? Thanks!!!

To get your Wordpress site to work, there is a mysql component in Xampp.You need to turn it on. Then go to localhost/phpmyadmin adn create a DB for your website. Once in the DB you need to import the DB of your running site and try loading the index.php page. That should make it work.

Related

xampp does not run php, browser asks what to do with file

I just installed xampp from www.apachefriends.org.
Per the instructions I ran
sudo ./xampp-linux-*-installer.run
Then xampp started and I saw the gui control panel. Everything great so far.
I verified it works by going to localhost in Firefox. I saw the welcome screen.
Then,I navigate to my test html. It is a contact which runs a php file when clicking submit.
Then firefox sends a message what to do with my php script, sendeail (save or select an application). sendeail is a no-brainer php script for email which I found on the internet years ago. It works when running from my server and has been for ages. Just now running locally with xampp started, Firefox doesn't know what to do with it.
What should Firefox do with this file?
Do I have to configure xampp somehow?
I couldn't test in Opera or Chrom(ium), the submit form doesn't appear for some reason on my local computer, but whose browsers work fine when accessing the page on the server.
I am running in Linux Ubuntu 16.4 LTS, Firefox 65.0.1 64-bit
--- edit ---
Specifically, the question is that the web browswer sees the .php file and tries to open it, what must I do for the web browser to be passed the code within the .php file, instead?
.apachefriends.org has no explanation of this. I found another page which explains, https://www.fayazmiraz.com/how-to-run-your-first-php-code/.
One has to put their php code into /etc/xampp/htdocs
That's so counter-intuitive!!! OMG why can't I keep my files in my development directory. Yeah, I can test this way, but I'll have to keep updating that directory whenever I have a program change! Thank you

Connection to database when changing from online to local server (wordpress)

I'm starting to get crazy with this.
I have to do some modifications to a wordpress website that i didn't create. I have access to the hosting so I downloaded all the files and a copy of the database.
After creating and importing in the local database I went to wp-config.php and change the hosting parametres (user, pass, server,...) for the local ones.
But here comes the troubles. When I change the online server dbXXXX.db.1and1.com to localhost it suddenly stops working and files called index.php won't ever work again
(I get "localhost server not found" error),
even if I change the source folder, or restart MAMP or restart the laptop... The only solution is to unistall MAMP, restart the system and install it again, but when changing the name of the server to localhost it happens again...
Well... If I copy the content of index.php in another file (for example index2.php) and set the parameters to the online server it works again until I change server to localhost.
When I say "it works" means that at least I get "error database connection" from wordpress (due to the online hosting does not allow external requests to its databases).
Can somebody help? Do you need some extra information? Thanks!
MAMP did some crazy this on my PC to, so I decided to switch to WAMP -
http://www.wampserver.com/en/
You may give it a try ?!
Finally I found the error. It's due to the file ".htaccess" that Wordpress (or I don't know who) creates for using permalink and MAC OS X.
When unzipping the web downloaded from the hosting the OS deleted that file because only system files can start with a dot (".htaccess").
I didn't find the solution and just start to work in Windows with BootCamp and all was fine. I was in a hurry to finish this job so I didn't have more time to try new solutions.
So I have not the solution but the source of the problem. Hope this helps someone at least finding the problem and save some time.

MySQL in XAMPP stops unexpectedly whenever an activity is created in MOODLE

First of all we created a moodle site on our local machine. Afterwards we integrated our work using TFS (Team Foundation Server). Now we changed the ibdata1 file in our database which includes the change of all people and took the latest version of the site from TFS. But now whenever any activity or resource is being created in MOODLE site, mysql stops unexpectedly and says DATABASE READ AND WRITE ERROR; while login takes place effectively and reads the username and password from database. The error message shows that your database must be corrupted or you may not have the priveleges or block port or shutdown by another method. While log shows database "you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support." and sometimes "The InnoDB memory heap is disabled". Please help.
Have you copied the database frm files rather than doing a data dump? This won't work. You need to do a database dump and restore.
On the original server either use phpmyadmin or mysqldump. Phpmyadmin should be already installed by xammp
If the server is your local machine, you can access phpmyadmin via
http://localhost/phpmyadmin
Then go to database name, click the export tab and click go. This will download an sql file.
Then on the destination server, do the reverse. Go to phpmyadmim, you will need to create a blank database, then click the import tab and select the sql file.
Also copy the moodle data folder, this is a straight forward copy.
http://docs.moodle.org/26/en/Moodle_migration
Don't try to merge 3 databases, the id's will be out of sync and the data will be completely useless.
If the code from the other developers has been written correctly, they will have install.xml files and possibly upgrade.php or install.php files to make any structure changes to the database.
http://docs.moodle.org/dev/Upgrade_API

How to debug wordpress admin user search in MAMP

I'm developing my Wordpress site locally on OSX 10.8 using MAMP Pro v2.2.1. Everything works normally EXCEPT for when I'm logged in as an admin user and I go to Settings > All Users and then try to search for a specific user (using the search bar at the top). Whenever I do this, the form seems to submit, the little spinner on the browser starts turning... and then nothing happens. No errors in the console. No 500 page. Just spinning wheel forever. And after that I can't open any of the other menus unless I stop/start MAMP. I have a lot of experience debugging wordpress plugins and themes, but I have no idea how to debug admin stuff since it's provided by the core.
What I've tried so far:
All other menu pages respond normally (unless I cause this crash).
All other admin menus respond normally, including search functionality.
The live site works fine on the server, including user search
My colleague does not have this problem when checking out the same code and testing on his PC with XAMP.
I ran CHECK TABLE wp_users and MySQL returned "Ok"
I checked MAMP's php_error.log, mysql_error_log.err
Another detail is that after I trigger the problem (by searching users), I can close the window, browse to other websites, and when I return to my local site it's STILL broken. The only way to resolve it is to restart MAMP
I would love any suggestions for how to debug this problem because I'm in the middle of a project that involves user registration and the inability to search users is really inconvenient.
Have you set up a local database to use, or is your MAMP copy of the site connecting to the live database? Remote database connections are often slow and may time out if you're opening and closing connections quite often (or not closing them all).
I was able to solve this by deleting a bunch of users from the wp_users table. I suspected that I was only having this problem in the users table because that was by far the largest table (it had recently been dumped from the production site with around 9000 users). I guess MAMP's MySQL was crashing because it couldn't handle the search query on such a large table. As soon as I removed most of the rows the search started working normally again. I'm sure there's another solution for someone more familiar with MySQL configuration in MAMP.

Unable to deploy/move forward with simple web app

Beginning details:
Windows 7 Professional 64 bit
WAMP Version: 2.5
MySQL Version: 5.6.17
PHP Version: 5.5.12
Apache Version: 2.4.9
I also have Git, Heroku Toolbelt, etc.
I'm trying to deploy a PHP inventory web app I have on my computer using Heroku.
Currently, it's installed on my PC using WAMP server. Up to this point, it was just a web app used at a country club where any computer/phone/tablet could access and adjust inventory as long as they were on the same wireless network as the server.
Right now, I'm trying to get to the point where the country club can access the app from anywhere, and figured, I could host it on Heroku.
Every tutorial I watch/read explains how to deploy a single index.php file that contains a single line of code saying something like, "Hello world!", but this app contains 8 folders and 22 PHP files, all in the "www" file of WAMP. I've tried learning the concepts of how this works (creating a single file for everything; trying to deploy the index.php I already have, etc.)
I have tried tutorials and a lot of Heroku reading and attempts, but I'm unable to move forward with anything in terms of adding user authentication or the ability to sell it to restaurants/country clubs. I've combed through every word on Heroku tutorials, and I don't run into a single error during anything I try, but at the end of it all, when I try "heroku open", it opens up a blank page.
My "www" directory contains:
- cgi-bin
- css
- dbBackup
- img
- inc
- js
- tcpdf
- tmp
Then, there are all the PHP files of the different functions of the app listed below those.
My main question here is...what is the file that gets deployed on Heroku in this situation? I don't understand how the CSS, JS, and other database-related functions are included in a single index.php file that is apparently the file that's deployed when you launch a web app like this.
Thank you!
The default page loaded when a site is accessed is typically "index.html" or "index.htm". This file would normally have the content to create the initial splash page with links to the different services you might offer. Those services are what you would use php for with the supporting data in your MySQL database. In addition to copying your base files and directories over to the Heroku server, you will also need to create the MySQL tables and then populate them with data. This is a relatively simple process using the MySQL Workbench. It may be tedious if you have lots of tables and schema, but it is relatively simple. Comment back if you need help in this area or would like to discuss further.
Heroku runs a standard web server and looks for "index.php" as your starting file by default. You should have either an "index.htm", "index.html", or "index.php" file in your current base (www) directory. If you don't then it's likely that you currently start your app by going to a URL (www.yourwebsite.com) followed by a slash and some other text, such as "/tcpdf/startup.html".
If you have one of the index. files, then that's your starting point. Copy the complete set of files and directories over to your heroku site and then test it based on the URL they have given you, which will automatically look for an 'index.php' file. You will need to back up and restore your database from your local system to the heroku server, which is relatively straightforward using the mysql workbench. You'll need to recreate the users and their schema permissions on the heroku site so that the php files can access the new database.

Categories