Web lists-archives.com

Re: how to force mysql to use the name of my machine instead of localhost

On 04/11/2017 07:45 AM, Abdelkader Belahcene wrote:
Thanks for reply;
I give more details.
I install wordpress on my machine, it works fine on local,  I mean i if
write in the browser localhost/wordpress, it 's OK.

I can use myIP/worpress on a remote  machine to connect my server, It seems
working  fine, I get the main page,
BUT, CSS files are not read, I know that by prospecting the code source of
the page.

Wordpress store everything in database,  and so the name of the CSS file
for example, unfortunatly,  the path  used is full address of the file like
here is the Big Problem

When the connection is local, no problem, since localhost is the host of
the server;

when the connection is  like :   http://myURL/wordpress,   we SHOULD FIND
the CSS file with  http://myURL/wordpress/blabla/style.css

 To solve the problem

   - either  we remove the absolute path for the files, and keep only  the
   relative part,  instead of storing  localhost/wordpress/blabla/style.css, we
   keep only wordpress/blabla/style.css
   - or we replace the localhost by the name of the machine or IP, that is
   what I want to do, I mean instead of storing in DB, localhost I tore the
   name of my machine like bela.enst.dz, the connetion w'll be done with
   this name and the problem is then solved

I used xampp to install apache, mysql and php. But the problem is the same
when I installed each element alone ( apache2, php, mysql)

when I used the command : localhost -f , I got the correct name
tmp$ hostname -f

thanks a lot for any idea



It depends to a degree on the details of how you installed WordPress [that is using apt-get/Synaptic/etc or downloading zip file from wordpress.org]. For that I suggest searching the Subject line of this group for about the last 5 years.

Some links that this Debian & WordPress newbie has found enlightening:

If apt-get/Synaptic/etc used for installation
http://localhost ["Apache2 Debian Default Page"]