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

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.

Related

Apache 2.4 Rasbery PI server requested url not found port 80

I am making a website using my raspberry pi with Apache 2.4, php5, and mysql. However, my website randomly stopped working. I went into phpMyadmin and created a database and it looks like after that it just flat out stopped working.
I believe the issue may be in the apache configuration since I can't even serve a simple php file.
PS. I am following a udemy course and used his exact code to test if it was my replicated code causing the problem. This didn't help. Also by putting a file called test.php and going [rasberypi IP addr]/test.php gave me the same issue not found.

WAMP server not starting Windows 7

I had installed wamp server successfully but after starting all services it's not turning into green. I don't know exact problem also there is no port blocking problem.
Default Apache port 80 is not using by any other program.
I am trying to find out the error but not getting any.
All the error log files are empty.
I also checked mysql port and don't have any issue.
Did you have WAMP instaled before on this current windows machine?
Did you select the explorer.exe when promted?
I had same problem after i tried to instal wamp on same location where the last one was.
You need to uninstall the current wamp, delete the folder, clean you system registries and junk files, use ccleaner for this and then instal wamp again.
I know you are professional but I will give this suggestion considering that you still beginner :
remove this one completely and reboot your machine then create new folder ,if you have tow or three partition , create it in D and name it for example wamp.
when you start installation make sure that you select correct path to your folder wamp and when you write a server name , just write localhost without .com then write the user user#localhost and make password.
after that type at browser localhost and see what what happened.

Error 0 couldn't connect to host in wamp windows 7

I have a joomla GIT repository of my project. We are using wamp and windows 7 as a development environment. This repository works fine on one machine. But when we tried to clone same repository on other two machines, we are facing a strange error.
Error is: Error 0 couldn't connect to host
As shown in screenshot.
All other repositories on those two machines work fine.
There is no error logged in under any of error logs file (apache, php and mysql).
I enabled joomla's error reporting. Searched on Google but, no luck.
Please help.
Thanks.
When you clone your Joomla to another machine, there are several things you need to double check:
Not only the files from the GIT, make sure the database is the same on the other two machines as well (export from the first one, import to 2 other one using phpMyAdmin).
Make sure the configuration.php file on two other machines re-corrected, includes: path to logs, tmp folders; database information (host, username, password, database name).
It should works.
Well, I debugged little bit more and finally found the solution. It was a small issue with missing web service link in one table. We are using com_api for web services. On first machine web service link value in table was local value respective to that machine.
On remaining two machines, we updated this to local value of those respective machines.
And it worked :)
This is not a standard Joomla error - it's either that this error is thrown by an extension or it is a server error.
Try adding a die(); at the beginning of your index.php file and see if it actually dies, if it doesn't, then this is definitely a server error.
If it does die, the use the function: get_included_files() and then make a quick search on all the files included on that page for the sentence "Couldn't connect". You will find the culprit easily this way.
Check your .htaccess file, maybe they have some rule which can not be met. (Rename this file if it exists and see what happening)
But I think that the problem is in the network settings. Errors often come from dns issues or, curl connection restrictions.
Check your DNS records
Check your Curl settings and try to create any Curl request.
Check your .htaccess
I don't think this error related to Joomla , I think it is connection from PHP to Linux, try to change the port of the Linux.
and restart the Apache and try again.

(AvastSVC.exe and XAMPP) / (Virtual Host on XAMPP)

So I installed XAMPP and it worked fine at first (At least I think so. I typed in localhost and got the XAMPP page).
I have the files for the site I'm working on in my Dropbox folder so they stay up to date across my computers. I was looking for a way to point XAMPP to my working folder so I didn't have to work in htdocs and then move it back to Dropbox.
I found this thread:
Make XAMPP/Apache serve file outside of htdocs
And I followed cmcculloh's answer on how to set up a virtual host.
As the last step in his instructions said, I restarted Apache.
Except it won't start.
I click Start in the control panel and it says 'Starting apache service...'
....and it sits there
After Googling about it I saw tips like disable make sure port 80 is clear and disable anti-virus. And use 'netstat -nab' in a cmd prompt to check if something is using port 80
Well AvastSVC.exe is using port 80. What I don't get is why it worked fine after I installed it, with Avast running.... But it wasn't until I tried to restart that suddenly Avast is getting in the way.... So I'm not so sure that that's the problem.
Maybe it's something I did when I was trying to set up the virtual host?
I just want to test php without uploading to a web server D=
Edit:
Oh and btw, I closed Avast and made sure the process was gone but it still shows up under 'netstat -nab'. I looked under Services and there is still an Avast service but it won't let me stop it =S
If this is just for testing/learning/development purposes, perhaps you could try using EasyPHP and set an alias to the Dropbox folder with the HTML files within. Also, I recommend you use port 8080 for development, not port 80.

WAMP server is not working

I have downloaded some files which have .php extension.
Then I installed WAMMP server on my, but I am not able to view those files. I have also turned off the IIS from the add/remove windows program. Still, I am not able to view the pages.
I'm presuming that by WAMP, you are using Apache as your server? You need to find your www folder in C:\WAMP\www and place files in there.
Here is the wamp server I use.
http://www.wampserver.com/en/download.php
I have also used this one in the past.
http://www.apachefriends.org/en/xampp.html
Click on the wamp server icon on your taskbar, go to Apache and you will find Test Port 80 in there. That will show whether port 80 is available or not. If not, go to httpd.conf file which is in the Apache menu of wamp server, find line Listen 80. Change 80 to 88. Restart All Services in wamp and that should work. Let me know if that helped.
How are you trying to view the pages? Why exactly are you "not able" to do it? Are you aware that PHP files are basically programs that run on a server, and you view their output using a web browser? Assuming that you have actual PHP files (rather than their output) and all the resources that they need, you will have to put them into the source folder that WAMP is configured to display, and then you will be able to view them by going to http://localhost in your web browser.
in the run put mmc - on the consol file / add /remove item choose internet information service and under website turn off the iis
if you installed in the past wamp/mysql selete all and reinstall only the wamp
Click on the wamp server icon in the taskbar and test "localhost".
If that works, click the "phpinfo()" link on the page.
If that works too, your wamp server is working and you should be able to execute php files.
If not, you need to make sure it is installed properly and started properly.

Categories