Jump to content
jon9china

setup local machine to test templates, etc

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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi jon9china,

Martijn wrote a great tutorial about a setup which works great. I use the same configuration with a few minor tweaks, but it has been running smooth for more than a year. When running a newer version of Mac OSX you might want to tweak some stuff since Apache has been updated to 2.4.

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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)

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Depending on the setup of the server as subdomain might need another rewritebase in the .htaccess file.

  • Like 2

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

What sort of errors are you getting? You can find the log files here:

/Applications/MAMP/logs/apache_error.log

/Applications/MAMP/logs/mysql_error.log
/Applications/MAMP/logs/php_error.log
or just use MAMP's Log menu.
  • Like 1

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...