![]() Thanks to anyone who can help me solve this! I can find tons of stuff about PHP being slow or MySQL being slow, but nothing about PHP+MySQL being extremely slow. The issue must be PHP's connection to MySQL - that's as far as I've been able to reason. Using the MySQL CLI client the user select query doesn't even take measurable time - it's done before I've even let the return key up. But again, didn't take much testing to figure out that MySQL is working faster than I need it to. I tested PHP by running this little script: header("Content-Type: text/plain") ĥ000 sha1 calculations and the page is still displayed snappier than I can refresh my window. ![]() ![]() I thought it was PHP's fault at first, but PHP code and static files are served snappier than I can click refresh. $result = mysql_query('SELECT host,user,password FROM user ') Then to check if it was PDO's fault I tried using mysql_connect instead: $con = mysql_connect("localhost", "root", "") The above script takes just about 3 seconds to run (although it took closer to 8 seconds to load the first time I ran it.) $users = $statement->fetchAll(PDO::FETCH_ASSOC) $statement = $con->query('SELECT host,user,password FROM user ') I made a small test case to shift the blame off PHPMyAdmin: $con = new PDO("mysql:host=localhost dbname=mysql", "root", "") It didn't make sense that on localhost it should take almost 5 seconds for every page to open. When first opening PHPMyAdmin I noticed it was extremely slow. Note, if you have database connection issues, you will need to locate the database connection file within your project and update the connection.I just did a fresh install of XAMPP. Here we can make changes to the site without worrying about affecting the live site! Now that everything is set up, we can open up our browser and visit testapp.build, and we can see our local site. At the bottom of the file, add the following: At the bottom of the file add the following code:įinally, for the last step, open up Notepad as an administrator and open C:\Windows\System32\drivers\etc\hosts. Now that we all of our files and database setup, we need to create a virtual domain for the site. This will complete copying the database locally. With the import tab open, select the.sql file and press Go at the bottom. On the sidebar, click the newly created database and click the import tab. Once phpMyAdmin is open, create a new database with the same name as the live database, in my scenario, it will be 000example. With the XAMPP Control Panel open, start Apache and MySQL, then click the Admin tab on MySQL. The first step is to copy the files from (C:\Users\#YOURNAME#\Desktop\Backup\) into your XAMPP htdocs folder, inside of a test folder (C:\xampp\htdocs\test\). Now that we have everything needed to recreate the site locally, we can start working with XAMPP. Simply download all the files from your root level connection and save it into the backup folder (C:\Users\#YOURNAME#\Desktop\Backup\). Using Filezilla, enter your FTP credentials and create a connection to your server. You will need FTP access to do this, and an FTP client, we suggest Filezilla. Now that you have a copy of your database, all that is left is to grab a copy of all your files from your server. Move the file to a folder that will contain a backup of the files and folder.Click the export tab, set the format as SQL, and press Go.Sign in to phpMyAdmin and select the database you want to export.It is possible that your site doesn’t use a database at all, if that is the case you can skip to the next section. Once you have XAMPP set up on your site, the next step is to export a copy of your database through phpMyAdmin. Open the xampp folder (default for windows is C:\xampp, but it could be different if you changed it during installation), and launch the xampp-control file. Once XAMPP is fully installed, let’s test to make sure everything is working properly. Installing XAMPP is relatively simple, once you download it go through the installation wizard until it is complete. You can also use MAMP or WAMP, but in this guide, I will be using only XAMPP as it is cross-platform. The first step of the process is to download XAMPP. Step 1: Get Copies of Files and D atabase ![]() So how exactly is this process accomplished? XAMPP is the bread and butter behind this type of upgrade. To do this without affecting the live site, a copy of the site is made, recreated locally, debugged, tested and updated, and then transferred back to the live site. PPCĪbout six months ago, PHP 5.6 reached End-Of-Life, which means that for the months before December 2018, I was tasked with updating code on some sites that were not PHP 7.2 compliant. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |