I've switched all my WAMP, XAMP, Docker, and VMware development environments over to WSL2, and I'm as happy as a cut cat. So my PHP and MySQL are running in WSL.
So far I've tried the Windows version of the Trongate Desktop app, and it just hung trying to create a new app. I presume this is because it's looking in Windows for PHP/Apache. I have run into this before with dev tools using WSL, and a common solution is to run the Linux version of the software within WSL.
So I ran the Trongate AppImage, and got a little bit further, but after I enter the DB credentials, I get the error "TYPEERROR: CONN.QUERY IS NOT A FUNCTION".
Does the Trongate desktop app output an error log that might give me more information? Is there some way to set the paths for the Trongate desktop app to use?
Any help would be great!
Mac
A guide for setting up on WSL
2 years ago
2 years ago
#1
2 years ago
#2
Hi Mac,
It has been a while since I have played around with WSL2. My gut is telling me, all your issues are because of permissions.
I had it all running a while back, having Apache, MariaDB and PHP all running on WSL2 with Ubuntu and it all worked from Windows for me.
The desktop app will throw that error if it can't connect to your database. Be it not running, permission issues with the root or current user you have setup with MariaDB or MySQL, directory permissions, etc.. Linux is fussy about all that stuff.
I'll have a bit of play for you and return to share what I discover.
Cheers for now,
Si
It has been a while since I have played around with WSL2. My gut is telling me, all your issues are because of permissions.
I had it all running a while back, having Apache, MariaDB and PHP all running on WSL2 with Ubuntu and it all worked from Windows for me.
The desktop app will throw that error if it can't connect to your database. Be it not running, permission issues with the root or current user you have setup with MariaDB or MySQL, directory permissions, etc.. Linux is fussy about all that stuff.
I'll have a bit of play for you and return to share what I discover.
Cheers for now,
Si
2 years ago
#3
Si you're very kind; I really appreciate your help with this!
Once we figure out the process, I'm very happy to add to the documentation how to set up Trongate with WSL2. I'm going to try to get just the framework working on WSL, and that might help me understand why the Desktop app is having an issue connecting.
If I discover anything helpful, I'll share it here. Please let me know if you figure things out.
Once we figure out the process, I'm very happy to add to the documentation how to set up Trongate with WSL2. I'm going to try to get just the framework working on WSL, and that might help me understand why the Desktop app is having an issue connecting.
If I discover anything helpful, I'll share it here. Please let me know if you figure things out.
2 years ago
#4
Si I just want to confirm that I was able to get the framework running manually in WSL. This confirms that I'm using the DB credentials in the Desktop app and the issue must be as you said, related to permissions or something like that. I've tried running the app as root with --no-sandbox, but I still got the same error.
While doing the manual setup of the framework, I noticed a few tiny gotchas that experts like yourself and David probably don't notice.
1. I could not find any guide on how to set up the framework manually. Perhaps David has created a video for this, and if so, that's great, but it might be a nice idea to add a few lines to the documentation on the manual installation process.
2. I got a 500 error because I was using PHP 7.4. If you don't want to bloat the framework with code that checks for minimum requirements, something like a requirements.php file would be nice.
3. The 'BASE_URL' needs a trailing slash. This could be included in idea 1 above and also a one-line comment in config.php
I'd like to contribute, so I'm happy to do all of the above if you or David think they're good ideas.
Many thanks,
Mac
While doing the manual setup of the framework, I noticed a few tiny gotchas that experts like yourself and David probably don't notice.
1. I could not find any guide on how to set up the framework manually. Perhaps David has created a video for this, and if so, that's great, but it might be a nice idea to add a few lines to the documentation on the manual installation process.
2. I got a 500 error because I was using PHP 7.4. If you don't want to bloat the framework with code that checks for minimum requirements, something like a requirements.php file would be nice.
3. The 'BASE_URL' needs a trailing slash. This could be included in idea 1 above and also a one-line comment in config.php
I'd like to contribute, so I'm happy to do all of the above if you or David think they're good ideas.
Many thanks,
Mac
2 years ago
#5
Hi Mac,
This might be a bit of a long post but worth it if you want to run your web stack from WSL2 on Windows. After a bit of playing about, I managed to get Apache2, PHP8.3 and MariaDB working with the Desktop App and a Trongate app from localhost. I won’t go into how to install WSL2 on your Windows box, as you have already done that.
Before we start, let’s answer your latest questions:
1. DC has many videos on how to install Trongate via the Desktop app and does touch on the way to install it manually via GitHub. The way I would do a manual install is as follows: On the Trongate GitHub page (STAR it!), click the green ‘Code’ button and a dropdown will present a few options on the HTTPS tab – ‘Clone using the web URL’, ‘Open with GitHub Desktop’, and ‘Download ZIP’. Download Zip is the most common and is the option DC shows you in the video – ‘Automatic Installer’ card on trongate.io The other two ways are via the GitHub Desktop app, which I use too, and the Jedi way via the terminal using git from a terminal. Click the copy link button, open a terminal and paste this in: This will clone Trongate to a folder in ‘www’ and your Trongate app will be in ‘tg_app’. This also copies over DC’s git history '.git' and a '.gitignore' file which are hidden by default. You can either keep them or remove them – it’s up to you. You will need to edit ‘config.php’ and ‘database.php’ found in the ‘config’ folder to match your situation. The ‘Module Import Wizard’ will fire up when you navigate to your app’s URL and create the base tables in your database. If all goes well you should now see the welcome page in your browser.
2. Trongate requires PHP8+ since DC introduced union-type hinting. I added that to the README.md file on GitHub a while back with a 'php8+' icon at the top and info on requirements in the ‘Prerequisites’.
3. In DC’s videos (there are many) and the docs he points out the need to end the ‘BASE_URL’ with a forward slash – note a big sign that you have missed it is the CSS will not work on the Welcome page.
This might be a bit of a long post but worth it if you want to run your web stack from WSL2 on Windows. After a bit of playing about, I managed to get Apache2, PHP8.3 and MariaDB working with the Desktop App and a Trongate app from localhost. I won’t go into how to install WSL2 on your Windows box, as you have already done that.
Before we start, let’s answer your latest questions:
1. DC has many videos on how to install Trongate via the Desktop app and does touch on the way to install it manually via GitHub. The way I would do a manual install is as follows: On the Trongate GitHub page (STAR it!), click the green ‘Code’ button and a dropdown will present a few options on the HTTPS tab – ‘Clone using the web URL’, ‘Open with GitHub Desktop’, and ‘Download ZIP’. Download Zip is the most common and is the option DC shows you in the video – ‘Automatic Installer’ card on trongate.io The other two ways are via the GitHub Desktop app, which I use too, and the Jedi way via the terminal using git from a terminal. Click the copy link button, open a terminal and paste this in: This will clone Trongate to a folder in ‘www’ and your Trongate app will be in ‘tg_app’. This also copies over DC’s git history '.git' and a '.gitignore' file which are hidden by default. You can either keep them or remove them – it’s up to you. You will need to edit ‘config.php’ and ‘database.php’ found in the ‘config’ folder to match your situation. The ‘Module Import Wizard’ will fire up when you navigate to your app’s URL and create the base tables in your database. If all goes well you should now see the welcome page in your browser.
2. Trongate requires PHP8+ since DC introduced union-type hinting. I added that to the README.md file on GitHub a while back with a 'php8+' icon at the top and info on requirements in the ‘Prerequisites’.
3. In DC’s videos (there are many) and the docs he points out the need to end the ‘BASE_URL’ with a forward slash – note a big sign that you have missed it is the CSS will not work on the Welcome page.
2 years ago
#6
Hi Mac, let's get into installing this web stack in WSL2. I'm having issues with the help bar code block filtering, so I'll break this up into separate posts.
1. Update Package Lists - open your WSL terminal and run
2. Install Apache2
3. Installing PHP 8.3 - first, add the 'ondrej/php repository' then update
4. Configure PHP with Apache
Add these lines at the end
5. Enable gd, intl, and pdo_mysql modules for PHP
gd is for the image uploader, intl is for the URL slug for foreign characters, and pdo_mysql is for all the database CRUD Trongate uses in the Model.
6. Check permissions of your root web folder
Then adjust the permissions, which could be your issue...
NOTE: If you have installed Trongate manually via GitHub and when you go to its URL and see the module import wizard cycle when it imports the base tables into your database, it is because PHP needs permission to delete the SQL file. To get that working trywhere '/var/www' is your web root folder.
7. Start the Apache service
You should now have Apache2 running on 'localhost'
1. Update Package Lists - open your WSL terminal and run
2. Install Apache2
3. Installing PHP 8.3 - first, add the 'ondrej/php repository' then update
4. Configure PHP with Apache
Add these lines at the end
5. Enable gd, intl, and pdo_mysql modules for PHP
gd is for the image uploader, intl is for the URL slug for foreign characters, and pdo_mysql is for all the database CRUD Trongate uses in the Model.
6. Check permissions of your root web folder
Then adjust the permissions, which could be your issue...
NOTE: If you have installed Trongate manually via GitHub and when you go to its URL and see the module import wizard cycle when it imports the base tables into your database, it is because PHP needs permission to delete the SQL file. To get that working trywhere '/var/www' is your web root folder.
7. Start the Apache service
You should now have Apache2 running on 'localhost'
2 years ago
#7
Now let us get on installing MariaDB, which is where I was having issues with the help bar code block filtering...
8. Install MariaDB and fix permissions
and start it up
Change the default Linix auth to 'auth_socket' and set a blank password for root
Execute some SQL
Restart MariaDB
Now, you should be able to connect using the root user with no password
9. Download the Linux version of the Trongate Desktop app and place it in your home directory, then make it executable
Then run it and create a new Trongate app.
10. If all went well you should have a new app installed by the Desktop App. If you see a folder structure in your browser on the welcome landing page, it means mod_rewrite is not enabled.
Open apache.conf and edit the following
Save and restart Apache
I hope this helps. Feel free to reach out if you have any questions.
Happy coding!
8. Install MariaDB and fix permissions
and start it up
Change the default Linix auth to 'auth_socket' and set a blank password for root
Execute some SQL
Restart MariaDB
Now, you should be able to connect using the root user with no password
9. Download the Linux version of the Trongate Desktop app and place it in your home directory, then make it executable
Then run it and create a new Trongate app.
10. If all went well you should have a new app installed by the Desktop App. If you see a folder structure in your browser on the welcome landing page, it means mod_rewrite is not enabled.
Open apache.conf and edit the following
Save and restart Apache
I hope this helps. Feel free to reach out if you have any questions.
Happy coding!
2 years ago
#8
Thanks so much Si! You are a legend! Thanks for taking so much time and putting so much effort into answering my question! A great resource for the future. Unfortunately it's still not working for me but what I'm going to do is create a second fresh WSL and replicate your steps. My existing setup already has a lot of customisation as I use it for React Native, Node, etc. and something is messing with the Desktop app.
Many thanks,
Mac
Many thanks,
Mac