I am an amateur programmer. I've played with varoius languages over the years but php is the one I know best and often reach for even when I'm sure a real programmer would say I'm using the wrong tool.
I had a developer build a wordpress site for me with a custom theme. I have subsequently written a couple of plugins in pure php that work just fine.
I am now wishing to add another plugin for my site that is going to require a little more frontend trickery. The last time I did anything like this was long before reactjs existed and I cannot remember much javascript - however I was able to master some ajax with php and have old code I can look at to remind myself.
I have installed node and then react on my windows laptop and have built a few hello-world apps. But I now want to write a plugin that will work on my wordpress install.
I am trying to follow this tutorial https://www.green-box.co.uk/create-a-wordpress-plugin-that-uses-a-react-app/. It says that a prerequisite is to have node installed - which I have done on my plesk server by following the instructions for adding it through the "add/remove components" of my plesk web interface, rather than over command line.
Now when I SSH to my server, cd to the /wp-content/plugins/helloworld/ and type npm create-react-app helloworld I get the error:
nodenv: npm: command not found
The `npm' command exists in these Node versions:
12
14
16
18
I think I'm fundamentally misunderstanding how reactjs works but can't seem to get my head round what to do. Have I got the 'wrong' node installed? Or am I supposed to build the code on my local machine and somehow compile it and upload to my web server? Last time I used javascript it was just dumped in plain text files and referened in the html header like css files. I'm sure it's all quite simple but I'm wondering if I shouldn't just ditch the idea of learning any react and doing it all with vanilla javascript.
Could any of the wise heads out there point me in the right direction with a clue? I'm too old for all this new-fangled techology I'm sure this is how my dad felt when they invented cellphones :(
Related
I use Laravel framework and as you know there is a something named Maintenance Mode. That's perfect for debugging the online version of your website. I mean, you can simply deactivate your website to open by this command:
php artisan down
Also you can make it alive again by this one:
php artisan up
Ok all fine .. My question is, how can I see the result of debugging on my website in this case? I mean, when my website is down for my website's user, I need to load it and do some tests on it .. but sadly it is also down for me.
Anyway, I'm looking for an approach to shut down my website for everybody except myself. Any idea?
Create a local development environment, preferably with something like Homestead or Valet.
Basic rule of thumb on the internet: if you can see it, someone else can.
The local environment also gives you the benefit that should you mess something up, no end user will experience that.
Hello I would like to create a simple PHP CLI to do some scaffolding. For a new project I am working on, we are using Magento to build an eCommerce store. Magento to comes with many default modules, but you can also create your own and we will have to be creating many custom modules.
I would like to create a simple PHP CLI which can be run to generate a default file path/structure for a module. It would be passed in something like the module name and maybe even path of the application and then generate the template folders and files.
I am new to PHP development, so i think this will be a simple enough project and a good learning experience. However I am having trouble knowing where to start. The end goal would probably be to have it archived in a .phar file that can just be run on the command line.
Any suggestions on how I can get started with this?
Thanks for any help, it is much appreciated.
No reason you can't. PHP in the command line reads the $argv array from the command line.
Here's one of my CLI apps; perhaps it can be instructive: https://github.com/dalecosp/NixArchive/blob/master/archive
I need to know which are my options when deploying codeigniter/laravel apps.
I develop locally all the time at my home and when i go to work i need some quick way to push all the changes to the server.
Application code needs to be updated, database schemas need to be migrated, and application servers must be restarted.
I do all of this manually wasting a lot of time and i need some automated way kinda like capistrano in Rails environment.
What are my options here ??
Update:
I got my own server machine, and everything needs to work on an intranet environment without internet connection.
I've used the following:
Salt - http://www.saltstack.org/
Worked well, a bit fiddly to setup. Super fast deployment. Lots of control. Less learning overhead that Puppet & Chef, has some level of native MySQL tools.
GitHub
Requires a internet connection to/from your machine - one where, at some level, the end point as write permissions to interactive scripts.... Works, but makes me nervous. Pulls are better than pushes, and it's better than most other solutions.
Custom shell scripting
Yeah - this is the most common, just tar up the entire CI dir once it's been validated on staging and push out using Salt...
Scalextreme
We've been looking at this for a few months - the interface is from the 1990's, but it's got really nice functionality, including system-independent script library that you can target at any machine.
Turnkey Linux
The hammer - this will migrate an entire system image from a desktop to EC2 is something like 5 minutes. Works great and you can also move stuff between VM systems. In the end, I think that updating AMI's on EC2 is so easy that this might be one of the answers...
Nothing has truly been satisfactory and DB schema changes are a huge pain. So much so that for client configs, we're moving from MySQL to Cassandra, which is basically schemaless. CI installer is interesting, but I'm not sure how it handles updates.
I recently came across this CodeIgniter Installer on GitHub. I've played around with it a few times and it works like a charm for me.
It's as simple as putting it in your root directory (alongside your system folder), generating a MySQL dump, and editing a few files. Full instructions are here
I hope it works for you as well as it did for me.
I found this Laravel Installer on Github which might be useful. (First I came across this question after searching for Laravel installer in Google, then searched Github for Laravel Installer)
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Recommended server for Continuous Integration for PHP Project
Hi,
I'd like to try Continuous Integration. I'm mostly writing PHP application with Zend Framework to be deployed on linux server.
I took a look to Hudson, Phing, Ant, but all of these tools looks like at the mean time doing the same thing and not.
Do you have any feedback and good tutorials to start things?
Most wanted feature would be the ability to check PHPUnit test, change SetEnv setting in .htaccess file, runs somes scripts, adjust rewrite url settings (i'm using vhost locally), statistics, notifications, and others feature you think essentials.
Hudson got renamed, to Jenkins - not much more has changed with the code iteself, but there has been something of a rush of new projects around it.
In the PHP space, there are a couple to make it easier to setup and use though - jenkins-php.org, similarly, there is php project wizard which even further automates new projects within the structure of jenkins-php.
Phing and Ant are automation tools, you write XML with various commands and it acts upon them.
Most of the feature you are looking for are best dealt with by various different means.
Run PHPUnit test - Jenkins, with the tools within it, as setup by jenkins-php, and with the actual project created with PPW.
change .htaccess file - depending what yo are doing there, you may be able to setup your local development environment to avoid having different code. I try to keep changes only in the configuration .ini file - maybe a switch based on the local manchine hostname, or a SetEnv in the apache Vhost.
A number of the rest could be done by a deployment tool, like Capistrano. I've used it to deploy a couple of PHP-based sites and the relevant plug-ins to remove rails-ish behaviour and use more usual PHP setup are easy to install. http://capify.org has details of them
Im thinking of updating my practices, and looking for a little help and advice!
I do a lot of work on sites that run joomla, oscommerce, drupal etc and so I have created a lot of custom components/plugins and hacks etc. Currently each site has its own folder on my xampp setup. What I would like to do is have a default setup of (for example) a Joomla setup and when I make changes updates, I can do something which updates all the other folders that contain joomla, almost like an auto update?
Im also looking at using Aptana IDE more and SVN service such as unfuddle to share my work with others, but I have not used SVN before and not sure if its possible to do the above using SVN?
It would be great to be able to work on a main/core item and send the updates to both local updates and to actual servers, without having to maintain lots of different individual sites.
Suggestions?
Yes, SVN would be a great tool for this purpose. Store your code (eg: a custom Joomla component) in source control. Wherever you want to use that component, just do a checkout or export of that particular folder into your live site. Here's one way you could structure your repository:
unfuddle.com/myRepo/trunk/com_myComponent
unfuddle.com/myRepo/trunk/com_anotherComponent
Log in to your live server via SSH and run this command:
> cd path/to/joomla/components
> svn co http://unfuddle.com/myRepo/trunk/com_myComponent
Any time you change your code, commit the changes and then log back into the server and run:
> cd path/to/joomla/components
> svn up com_myComponent
A real benefit of this is that should you do an update and break something, you can always roll it back to the last known "good" version.
As for automating this process, you might be out of luck if it's on different servers. For multiple deployments on the same server, you could quite easily write a shell script to run the above commands for each site/component. If you needed this to be fully automated, you could even set up a cron job to run this script every day at 2am or something - personally I'd stick with the manual approach, but it's still an option.
For working locally with your SVN repositories, I'd recommend looking at TortoiseSVN (if you're on Windows): it's the simplest and easiest way to work with SVN.
For automating things, you could use SVN hooks for this. There is a post-commit hook, so every time you do a commit, your hook script could tell the other machines to do an SVN update to get the latest code.
For more info, see Version Control with Subversion - Implementing Repository Hooks.
I don't have a good answer for your situation, but I don't think Subversion by itself is the answer.
This Question addresses some of the concerns about Subversion's mechanisms for sharing across 'projects'.
Subversion can certainly handle the source code management part of this puzzle. The automated distribution, well I'd use another tool.
Look into Capistrano. I've used it a couple of times and once you figure it out, it's pretty good. Aimed at rails but should work for anything where you need to get code from a repository and deploy it on different servers.