Jump to content

setup local machine to test templates, etc


jon9china
 Share

Recommended Posts

I currently test changes to my javascript and templates by setting up some 'dummy' pages and 'dummy templates', and uploading everything to the server.

Is there a way to replicate my site on my local machine, so I can do away with keeping track of versions of my templates and other complexities?

I will be working on a Mac.

The easier the solution, the better, as I am not well versed with back-end technologies at all!

Thanks!

Link to comment
Share on other sites

I found this one to be the easiest to use:

https://www.mamp.info/en/

You can find a lot of tutorials on the net on how to set it up.

There are alternatives too, for example: https://www.apachefriends.org/hu/

Edit: and if you want to move it later on: https://processwire.com/docs/tutorials/installation-moving-and-troubleshooting/page5

Edited by szabesz
  • Like 2
Link to comment
Share on other sites

Another approach can be to setup a dev-subdomain on your online hosting provider and use an editor that provides editing of those files directly via ftp(, sftp, ftpes) behind the scenes. This has been discussed sometimes here in the forums too.

Good google searches for that can be: site:processwire.com/talk -"Viewing Profile" mac editor ftp

It depends on your hosting account, if there are resources for: 1 additional DB and the possibility to create subdomains, e.g. a dev.example.com besides the www.example.com.

  • Like 2
Link to comment
Share on other sites

Thanks a lot. This is all great information.  I think I'm going to try going the route you suggest, Horst.  I followed a couple of those relevant threads and think I'll start exploring some of those tools.  It seems like a solution I can wrap my mind around, and a cleaner way of doing what I'm already doing.

  • Like 1
Link to comment
Share on other sites

In short: nearly nothing more! :)

If you have an exact copy of your origin Database as second DB you only need to change the credentials in site/config.php to point to the dev-DB. Besides that, you should copy the index.php, .htaccess and complete wire and site folders to the dev.domain. That's it!

  • Like 2
Link to comment
Share on other sites

Seems I've missed something. Getting a 500 internal server error.  Copied folders and files as described, and used phpadmin to export my database and then created a new db and imported the exported one. Modified the site/config.php file to point to it (tried pointing to original database, too), but getting the internal server error.

Are there some permissions that need modifying?

also I see something in the config file:

$config->httpHosts = array('www.mysite.com', 'mysite.com'); 

should this be modified to specify the subdomain?  (though I did try it and it did not fix my internal server error)

Link to comment
Share on other sites

Hi @jon9china,

hhm, yes, sorry. The httpHosts array needs to be changed to (at least) include the new hostname too. (Or is set to only hold this domain name). It is for security reasons, but this isn't the reason for the 500.

Regarding the 500 internal error:

You need to check write permissions for folders and files under site/assets/. (Including the assets folder itself.) PW needs write access to create / delete subfolders and files. During installation you have defined chmod values for files and folders for that, it is noted in your site/config file. (e.g. 0755 and 0644, or 0777 and 0666). Check if files and folders in the subdomain are assigned that way.

Also, if the 500 is gone and you can access the admin but get some errors there, you should go to -> modules -> refresh (search for new). PW uses cached informations for all modules (installed and uninstalled ones), including pathes. This needs to be recreated, too, if it isn't automatically.

Please report back when all is working ok, or if there is anything other that doesn't fit.

PS: here is little troubleshooting guide from Nico, regarding regular installation processes: Doesn't fit in your case, as your orig site is already running, but maybe is nice to have bookmarked for future installations on (foreign) hosts.(?)

Edited by horst
  • Like 1
Link to comment
Share on other sites

​Not sure what's the problem. I really appreciate the help. But still getting the 500 server error.

Permissions seem to be right on folders and files. Also checked the dev site against the operational one, and files and folders match accordingly (0755 and 0644)

Fortunately not an urgent problem for me right now.

Link to comment
Share on other sites

  • 3 weeks later...

Back to this thread again...I still haven't gotten a setup working.  I've tried installing MAMP on my Mac mini but am getting server error there, too.  I modified the config.php file in the site folder:

$config->dbHost = 'localhost';
$config->dbName = 'name_of_my_db';
$config->dbUser = 'root';
$config->dbPass = 'root';
$config->dbPort = '3306';

and copied wire and site folders to the htdocs folder in the MAMP application folder, along with index.php and htaccess files, and imported the database.

If anyone knows what part of the recipe I'm missing, I'd appreciate the kind help!

Link to comment
Share on other sites

 Thanks for reply, szabesz.  Here's what I find in the php.error.log, which doesn't sound like a fatal sort:

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; Wire has a deprecated constructor in /Applications/MAMP/htdocs/wire/core/Wire.php on line 47
 

No errors in the other two logs. but comes up on MAMP website page: 500 Internal Server error

Suggestions?

Link to comment
Share on other sites

I guess you have an up-to-date version of MAMP (which I do not have at the moment since I do not upgrade MAMP too often)

https://www.mamp.info/en/downloads/

And reading the sidebar, it ships with PHP 7.0.0 too. Do you happen to use it? I run ProcessWire 3.0.5 on PHP 5.6 and do not have any "deprecated notices". Anyway, since it is just a "deprecated notice", it should not be the cause of a 500 Internal Server error, but you might want to try switching to PHP 5.6.

Have you tried to install ProcessWire from scratch, so that you can see if that works?

Edit: PHP 7 maybe just an optional addon, and it does not yet ship with it.

Edited by szabesz
  • Like 1
Link to comment
Share on other sites

I know you are looking for a simple solution. I have not tried, but have heard some greatness about Caddy Server https://caddyserver.com/

Available for Windows, Mac, Linux, and BSD.

https://caddyserver.com/developers

Their page shows lots of great features. May be the simplest way for you. I will also give it a shot on another computer of mine as I currently run a full LAMP stack on my desktop.

Please let us know how it works for you!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...