how do I turn wordpress into a virtualhost? - php

I've tried going through the Wordpress tutorial but I also don't know how to fill in the php config file this shows up:
Basically i've got everything except for php?

Thats url is wrong, use http://localhost/wordpressFolder/
unzip wordpress righ there
C:\wamp64\www\
example final folder structure, just like your capture
C:\wamp64\www\wordpress
In the browser use
http://localhost/wordpress/
off course start apache before and you need create a database first, here
http://localhost/phpmyadmin

Related

Wordpress site failes to load js and css

I have this weird problem with my Wordpress Website. I worked on localhost and afterwards I tied to get my site online but i modified some configuration files and i don't know witch one is the fault. I am using XAMPP. The website right now is seems to not load js and css. Also on console log it gives 404 error for not fiinding the files it needs.
Landing page:enter image description here
Another Page:enter image description here
do you use gzip compression or such as it? if yes try to disable it, and make sure you have the right path
First, check that the file permissions are correct.
Also, if you have changed anything on your .htaccess files, overwrite them with the default ones: https://github.com/WordPress/WordPress
Also it's always a good idea to go to the permalinks page (/wp-admin/options-permalink.php) to update the links of all dependencies to the new URL.

PHP can't file contact.html, but it shouldn't exist? (Smarty Engine)

I've got a legacy PHP project to fix a thing or two. I've downloaded it via FileZilla and served it on my local machine with a local copy of the database. The project is exactly the same with the live one, yet the live one can open the url/contact.html but on my machine it says no such file is found. All other pages go for url/categories/ or url/products/ so I've tried altering the url but no use.
All the other pages within the site are simple: one .php controller one .php model and one .tpl smarty template view. Requiring no .html at all. But this one is somehow different. The .htaccess file is exactly the same as the live version. I've tried adding a rewrite rule to direct every .html to .php but didn't work. I'm lost and out of options, please help? It doesn't even have to be an answer,"Try looking into that" would work too.
I'm working via XAMPP on windows, and I've configured the https:// to http:// on my project but that's all. Even hidden files are checked and confirmed.
have checked that contact.html is a static file (like a real existing html file?)
is there some kind of "routing" within the PHP of the project? If there is route urls might be really anyware.. in the mysql database, redis, a json file and whatnot.. have seen them all.
try to debug where and how it works on the "production" server by using some logging to a file edit the file through filezilla and log to a 'mylog.log' file until you find out what is going on.. or if the site is not used all the time by clients - you can just try to echo stuff to figure out how this exact /contact.html works

How do i create my own project in xaamp/htdocs/myworkingfolder/test.php

I am trying to create my own folder, so i can work with php and try different things out.
When i try to go to my localhost/testphp/test.php it redirects to a wordpress installation. Why does it do that? It is just a folder with a simple "test.php"
It then want my database name and so on. It shouldt ask me about those things?
I have allready worked with wordpress before under htdocs where i had to change in the config file in order to connect to the database, but i do not seem to see the need here.
What to do?

Using Brackets for PHP files

I currently have wampserver running and I'm trying to do live preview of a php file using Brackets.io. However when I click live preview I'm getting
Project settings for: Getting Started
Live preview base URL: ______________
I'm following this tutorial on running PHP scripts.
My php file is in C:/wamp/wwww/php_proj1/php1.php so I've been trying to put this in my "Base URL"
http://localhost/php_proj1/php1.php
However everytime when I type that and enter it, it just asks me for the "Live Preview Base URL" again and nothing happens. I also tried putting the URL in my 'File->Project settings' and that also didn't work. I'm just running a basic php script that echos some words.
It works when I manually type
http://localhost/php_proj1/php1.php
in my Chrome URL but not when I use Bracets live preview.
What am I missing or doing wrong? Do I need to config anything in my wampserver? I've just started learning php and using wampserver so I'm not entirely sure what I'm doing wrong.
Thanks!
EDIT: I'm following these 2 tutorials on doing this and it's just not working for me.
tutorial 1 and tutorial 2
EDIT2: Found my mistake.. I did not do File->Open Folder to open the folder that I was working on... Thanks to everyone that helped me with this, I will definitely not make this mistake again. sigh
The Live Preview Base Url should be set to the same url that you would use to launch your project in a browser.
So if you have a project in C:/wamp/wwww/php_proj1/ you would launch that project in a browser by entering http://localhost/php_proj1/php1.php therefore that is what Brackets is expecting to be entered into the Base Url field minus the actual script file name.
Remember the DocumentRoot of localhost is pointing to the folder C:/wamp/www/
So enter
http://localhost/php_proj1/
into the dialog that requests the Base Url.
Assuming you are editing the file php1.php at the time you clicked the Live Preview icon that is the script that will be run in the browser.
Oh and of course you have to have WAMPServer and therefore Apache up and running when you do this as it is running the code through Apache so that the PHP code can be interpreted.
Found my mistake. I did not do File->Open Folder to open the folder that I was working on...
Try the same thing but with a simple HTML file.
Try launching your project with PHP's built-in server. Open a terminal/cmd window and go to the folder php_proj1. Now execute php -S localhost:8000. Now set your Live preview path to http://localhost:8000/. If this one does work, then there may be a problem with Wamp.
Now remember that no matter what, you're not supposed to contain a file in the Live Preview path, but only a folder path. When you contain it, you get to this URL: http://server/file.php/file.php (double) and that's not exactly what you want...
If none of these work - there may be a problem with either your computer, Brackets, Chrome, or both. Try to reinstall them (Brackets first).
My two cents, is the name of the project php_proj1 ? If not you'll have to use http://localhost/ as your base URL.
Also (When you are using Brackets) check the content of the Chrome Network tab. F12 Developer Tools -> Network -> Filter -> Documents
Try to investigate the URLs, probably that'll give you some insight

Opencart Images not displaying

Ok so i moved hosting. Everything is working great except i cant get images to show up on the site. The only place that they show up is when you are editing the product on the image tab. No images are displayed on the list of products nor on the front end.
I have no idea what is going on here. If it helps at all when i inspect elements on the list of products page the "src" is blank but has alt text. But on the front end there is just nothing, no image tag at all.
I am not really sure where to start on this one. I have tried changing the path on the
define('DIR_IMAGE', BASE_DIR.'/image/');
To the absolute path on the server to the image directory, but that didn't help.
I have tried a few things that i found on google like deleting the cache directory.
Any ideas on something anything to try to resolve this issue?
The easiest way to make sure all of your details are correct is to do a "fresh install" to generate the configuration files again. Here's what you need to do
Back up your config.php and admin/config.php files to config.backup.php
Create a new database to use (this ensures that your original remains and can be used once your configs are created)
Clear the contents of your original config.php files and make sure they are writeable
Go to http://yoursite.com/install and fill in the details for the site, including the new database details NOT THE ORIGINALS
Once install is completed, Open the config.php and admin/config.php and change the database details at the bottom to match those of the originals in config.backup.php
Delete the new database and remove the config.backup.php files if everything has successfully been restored
If it were me and you would like your site not to go down. I would simply do a search on the code base for your old domain, and more importantly do a search in mysql for instances of your old domain.
Searching your codebase is easy using grep on command line. If you are not comfortable with command line download Sublime Text editor, download your code base and use Sublime to very quickly search the entire codebase.
Use phpmyadmin to search your database and use this snippet to replace your old domain with the new one: http://www.mediacollege.com/computer/database/mysql/find-replace.html
Hope that helps
I would like to point out you should always back up your website before doing this sort of change (that includes your database), and always test on a development instance where available!

Categories