Can't export SQL files - php

I'm having a problem with exporting SQL files. When I click go it just opens the sql file with notepad, here's a pic:
The (9) shows how many times i've downloaded the file. I also can't see the file on my downloads folder.

You might have a problem with your phpmyadmin , please try use cmd or terminal to export all your databases and reinstall phpmyadmin again. This might fix the issue. To export using cmd or terminal use code below:
You should use mysqldump, since it tries to do the data dump without blocking the database tables.
mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump]
So it could be something like this:
mysqldump -u root -p mydatabase > /home/myuser/database-dump.sql

If you are getting SQL dumps in notepad then you are actually getting the SQL dump. I think only problem is you cant find the downloaded file because you must have specified different folder for saving downloaded files. Check your browser settings. Press Ctrl+J to see the recent downloads. Or easiest is copy that open notepad contents to new file and save as you want.

The big question here is: Do you want to solve your problem and not just workaround it with console?
I really think this is a windows/browser problem - not a PHPMyAdmin problem.
Looking at the line you have in that Notepad - I see bits of SQL for table creation and column data in your screenshot. It looks like a working dump. Your notepad view is very wide - most of the data is cut off.
On Notepad- Format->Word Wrap and compare it with a console dump. I have a feeling both files will be identical.
Next step - what browser are you using?
If you're using Chrome, you can go into settings and have it ask where to save the file before downloading (This setting: "Ask where to save each file before downloading"). That will let you switch the download location from your %appdata%/roaming to wherever you want.
Apparently - in the current version of Chrome, this setting will stop auto-opening.
Once you try getting that setting turned on ... try turning it off. It may just clear your problem as it did for the poster in the Chrome product forum.

Related

How to use VSCode to remotely edit website files?

I need to be able to remotely log into web servers for my clients and edit code remotely. I mostly use this for CSS changes, but also am starting to play with PHP as well.
I have tried to get Remote-Editor to work but it won't pick up the .remote file that I placed in the /home folder. The instructions don't really give great details on setting this up.
What do I do?
Use FileZilla, then set VScode as default editor (edit->settings->file editing->filetype associations and insert "php /usr/bin/code"). okey, now u need select your file on FTP and press "View/Edit", then ur file open in VScode editor. Done:)
Use an FTP client (like FileZilla), then set VSCode as the default editor. Anytime you open a file, it will open it in VSCode. I highly recommend that you download all of the code to your own computer and use it as a dev environment, and then, when you're finished with your changes, backup your site, then upload the modified files together. It's not required to edit files on your own machine, but it is recommended if you ever need to revert to an old version for whatever reason (like you made a mistake in the code, and now nothing works right).
Alternatively, you can use an extension like FTP Sync to code locally, and have the files be automatically synced for you.
Open Filezilla -> Edit -> Settings -> File Editing -> Filetype associations
Now you will have "Custom filetype associations:" situated on the right pane of the window.
Over there you have to write the command for opening VSCode for PHP files.
Step 1: Search and locate the VSCode Exe file setup install directory on your computer. In my case it was (C:\Users\Shubham\AppData\Local\Programs\Microsoft VS Code/Code.exe)
Step 2: Copy the directory path link of the ".exe" file and come back to the "Custom filetype associations:" inside Filezilla.
Step 3: Now type "php" then give space & paste the directory path that you have copied inside double quotes and then again give space and write "-open". The final code should look something like this
php "C:\Users\Shubham\AppData\Local\Programs\Microsoft VS Code/Code.exe" -open
Step 4: Click the Okay Button and have a coffee.
There are several approaches to this that are all editor-agnostic.
First, there is sshfs, which is cross-platform and you can install via your OS package manager. A simple approach would be as following:
mkdir -p ~/mnt/server
sshfs user#server.example.com:/path/on/server ~/mnt/server
Afterwards, you have the complete folder structure from server.example.com locally available at ~/mnt/server. Make sure you set up SSH keys to avoid entering the user password every time. You can find tutorials on that everywhere on the net.
For servers that only offer FTP access (shared hosting and the like), you can use curlftpfs in the same fashion.
To close the connection, simply unmount:
umount ~/mnt
For a GUI-based approach, you have several options. There is Transmit (macOS), which features mounting connections as volumes, Forklift (macOS) which is a Finder replacement that can do the same, ExpanDrive (macOS/Windows) and my favorite Mountain Duck (macOS/Windows).
If you plan to move lots of data, especially a lot of small files, Mountain Duck performs the best in my experience.
Just type this is Filezilla Settings->File Editing-> File Association
php /snap/bin/code
Open Filezilla and go to Edit >> Settings
Click on File Editing, and set the radio button to use Custom Editor
In the text field below you need to enter the full path to Visual Studio Code, this is usually found in the /usr/bin/ directory, so you need to enter the following /usr/bin/code
Next select the radio button Always use default editor and click OK to finalise the settings.
Most of the answers I see are for Windows. If anyone wants to associate File Types using Linux in Filezilla, the path is a bit different.
htm /snap/bin/code --force-user-env --no-sandbox --unity-launch
html /snap/bin/code --force-user-env --no-sandbox --unity-launch
js /snap/bin/code --force-user-env --no-sandbox --unity-launch
php /snap/bin/code --force-user-env --no-sandbox --unity-launch
You do not need to use the extra flags, but they are being used in the Menu Shortcut, so I included them.
To set VS Code as default editor for all type of files in mac use below steps:-
Click on Edit menu
Then click on setting option
Then find out File Editing and click on it (Not on submenu(Filetype associations))
Click on custom editor and then browse in application or download and select VS Code. And also click on checkbox "Always use default editor" and then click ok.
open filezilla->edit->file editing->use custom editor->browse(find the visual code path)
for find visual code path->right click on the visual code and open location and paste that location to the browse menu and find the visual code short cut
after that press ok on filzilla it will work fine
It's important that you start Filezilla as an administrator. That was the reason why it wasn't working for me.
Open Filezilla -> Edit -> Settings -> File Editing -> Filetype associations then type:
php "C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\Code.exe" %f
Note: substitute <username> with your windows username
Bonus: php can be replace with any kind of file format. Just write file extension name on lowercase.
I used this registry update to set vscode as my default text file editor (copy & paste into update.reg, open regedit and import the file):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit\command]
#=hex(2):22,00,25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,\
00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,4c,00,\
6f,00,63,00,61,00,6c,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,\
53,00,20,00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,00,65,\
00,78,00,65,00,22,00,20,00,25,00,31,00,00,00
After that the registry is updated as follows:
Of course you should not trust hex encoded registry updates you found in the internet. So copy 22,00 ... 00,00, remove all backslashes, linebreaks and whitespaces and convert through one of many hex to ascii online converters to verify the import:
After you made this change you can even edit text files with vscode through the "edit" context menu entry:

Can't find .sql file in sql query phpmyadmin (#13 Error)

I am trying to import a cities .sql file into my table.
I am using this github repository:
https://github.com/JoshSmith/worldwide-city-database
I have created the table, like it says in the repository,
but when it comes to importing the cities.sql I get an error.
LOAD DATA INFILE "/tmp/test_data/cities.sql"
INTO TABLE cities
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
(combined, population, country_code, region, latitude, longitude);
I also have a picture of it:
I mention that I am using a Mac, have read all the solutions and tried them out, but didn't work. I also made sure my file is in MAMP/tmp/.
EDIT: Sorry for the confusion from the image -> sql query. I have the file in /tmp/test_data/ . I have modified the query to look there.
You have the cities.sql? then you need to create new database ,give name:cities then import into cities your cities.sql file.
You indicated you had the file in MAMP/temp/ ...but the error indicates it's looking for the file in /tmp/test_data/. Check your tmp vs temp.
I suggest that you use the phpMyAdmin UploadDir feature instead. Due to various permissions issues, security means, and other idiosyncrasies those processes can be blocked from reading this file even though you provide the complete path. Using the phpMyAdmin UploadDir, you basically create a folder (mine is a subdirectory of my phpMyAdmin installation), add the directive to config.inc.php, and copy the file in there. phpMyAdmin shows it in a dropdown on the Import page. Again, you need proper permissions on the file and folder, but I find it easier than LOAD DATA INFILE.
If you prefer to continue to try the MySQL method, my guess is that it's a permissions problem. Make sure the webserver and MySQL processes have the proper permissions on the .sql file (and perhaps also on the directory it's in, though that probably shouldn't matter). Your webserver and MySQL error logs might have hints, also.

phpMyAdmin error: Cannot access browser storage

The full text of the phpMyAdmin complaint is ...
There was a problem accessing your browser storage, some features may not work properly for you. It is likely that the browser doesn't support storage or the quota limit has been reached. In Firefox, corrupted storage can also cause such a problem, clearing your "Offline Website Data" might help. In Safari, such problem is commonly caused by "Private Mode Browsing". '
And it shows up every time I do anything at all in phpMyAdmin. I've tried emptying the cache and local storage - which was empty anyway - but no joy there. I don't find that I have disabled local storage anywhere.
I've just installed phpMyAdmin, working against a local MySQL installation. Seems to work ok ... but I get the complaint on every single thing I do in phpMyAdmin.
While I'm here let me ask about the debian-sys-maint user with all privileges on the MySQL installation. I certainly didn't create that. I don't see a way to delete it either.
I had this exact same issue, and it was caused by Cookies being turned off. So turning Cookies back on solved this issue for me.
Not sure what the root cause of this error was (maybe an unfortunate Firefox crash) but getting rid of persistent site-related storage from my Firefox profile solved this for me.
Open your profile folder and get rid of the following:
places.sqlite
places.sqlite-shm
places.sqlite-wal
storage/
webappsstore.sqlite
webappsstore.sqlite-shm
webappsstore.sqlite-wal
On Mac OS X you can find your profile folder as follows.
In terminal type the command:
open ~/Library/Application\ Support/Firefox/Profiles/
Then look for the current profile folder, which looks something like 86fdt4d.default
NOTE: by removing these files you will remove all of your site visits (history) and offline web app data so make really sure that you are not deleting any essential data before continuing...
Try to completely un-install Firefox
sudo apt-get purge firefox
Check in your home that folder /.mozilla does not exist (otherwise delete it) & re-install Firefox.

app_dev.php not always refreshing . How to contrain Netbeans/Browser to display freshest version of code?

it's so annoying.
I'm working with Netbeans and Chrome (but other browers are not better) and i never know whether an error comes from last edited code or previosly edited.
app_dev.php suppose to take care of that, but its not.
I do not know whose cache is responsible for this: Netbeans, Symfony, Browsers.
How to contrain displaying latest version of my code?
edit
if do following steps its not work well:
physically delete cache (even command cache:clear --env=dev)
change code
refresh site
if do following steps its work well:
change code
physically delete cache (dev)
refresh site
Netbeans is an IDE. It will not cache any files I think. Try following this steps:
Use Ctrl+F5 in Chrome to refresh the page with discarding the browser cache
Execute php app/console cache:clear --env=dev after each source code modification
Check your URL in browser address. It should be something like http://localhost/web/app_dev.php
#Olim pretty much covered it all. Only thing I would add is to try physically removing cache directory and running cache:clear again...
EDIT:
I had numerous problems with access rights of my IDE (phpStorm in my case) which could not alter files stored in Apache's default location (C:\Program Files\Apache...). The main cause was the dreaded Windows's UAC which prevented any program to write in some more sensitive locations.
To solve this you can either disable UAC or you could set the proper ownership:
Right click on you project's directory
Click Properties
Click the Security tab, then Advanced button
Switch to Owner tab and then Edit button
Click Other users and groups and enter your username. Click OK
Make sure you check the Replace owner on ....
Restart all related software (Netbeans, Chrome, Apache service...)
Does it work now?

Replacing PHP file - file doesn't work anymore

I have a weird problem I cannot seem to solve (as a php noob).
I am working on simple php site (no sql involved). Everything was working perfectly till the moment I decided to copy over the files and edit them on another computer. All worked fine on the other computer as well. Then I took the files and copied them to the first computer again. Here came the problem: if I try to open ANY file copied from the second computer, it doesn't show anything, just a blank page. Even if the file was not edited at all on the second computer.
For example my index.php:
1. Copied from comp 1 to comp 2, no edits done
2. Copied from comp 2 to comp 1
3. Opened in the browser -> blank page
What's going on here and how to solve it? Is it some cache that apache is keeping? How to clear it? Both computers with OSX, however the second one was running MAMP, while the first had php/apache/sql set up.
Your permissions need to be set up correctly. Do the following:
Change the owner of the group to your user
chmod 0755 all the directories
chmod 0644 all the files
Then you are good to go!
You need to make sure that your permissions are set up correctly.
Apache Permissions
The blank page is displaying because Apache is encountering a PHP error somewhere, but is not set to display PHP errors.
Check out what is going on in your Apache error log and work from there. You could also look in the Developer Tools of a browser like Chrome, or use Firebug, to see what response your browser is getting from the server (most likely a HTTP 500 error).
I wouldn't recommend blindly changing ownership on files and directories until you know what is going on.

Categories