How to start/stop third part services during starting/stoping WAMP server? - php

I have installed several services for web apps (memcache, tomcat and mongodb).
They works fine, but I should start or stop it manually.
For example (cmd): memcached.exe -d start
I need these services only during running WAMP server, so i don't want to run these services during starting windows...
How to run these commands automaticaly duiring starting and stoping WAMP server (do the same thing with third part services as it do to Apache and Mysql services)?
Thank you.

I have not found right answer yet, but I have some lifehack (on memcache example):
Install any app as a windows service. (cmd: memcached.exe -d install)
Config your service: Start > Manualy (standart windows services routine)
Creat file "start.bat" and write down starting commands for all your services and launche it after starting WAMP server. (net start memcached)
Creat file "stop.bat" and write down stoping commands for all your services and launche it after stoping WAMP server. (net stop memcached)
It's not a solution, but save some time and resources for you.
Does someone knows how to run these files (start.bat & stop.bat) automaticaly during starting and stoping WAMP server?

Related

Apache2 and CakePHP project server deployment

Hi my CakePHP project works fine. I have pushed it to my server #www.zeyeland.com/register. So the cake app works great but I am not sure how to get my Apache2 server to run the app automatically. I have to log into my server and type bin/cake server to start it.
Some time ago, When I uploaded my NodeJS app to server I had to edit the .bashrc file and use the bash script command "cd/var/www/html/zeyeland-website/bin && pm2 start npm1 -- start and cd". This command starts my nodejs app automatically
Do I need a similar bash command with bin/cake server to run my Cakephp project automatically too?
You need to look for upstarting apache and mysql so that whenever your server reboots the services will start automatically.
Look for upstart at
https://www.digitalocean.com/community/tutorials/how-to-configure-a-linux-service-to-start-automatically-after-a-crash-or-reboot-part-1-practical-examples

Updating PHP file to server not reflecting its functionality in app

I am an iOS developer and also have some experience in PHP development as well. I got a project from other developer in which we have chat module that uses Socket programing with Ratchet(http://socketo.me/) for chatting purpose. We are using AWS Ubuntu instance for the backend.
When i execute this command "ps aux | grep php" on server than I can see a chat server php file that we are using for chatting purpose on a specific port number that port number we are also using in app for communication.
I want to add some more functionality so the main issue is that when I make any change in that chat server file and upload it to server in the same directory which is indicting in this command "ps aux | grep php", its not reflecting the changes in app while file is uploaded successfully. I also tried to restart server using "sudo service httpd restart" but didn't get any success.
Any suggestion would be highly appreciated.
Your chat is probably running with a command like:
php bin/chat-server.php
So restarting httpd won't help.
You should restart the service that runs the actual chat server.

Use behat with jenkins in amazon ec2 server

How can I setup and configure behat,ahoy,docker with jenkins in amazon ec2 server?
I want to run my behat feature's every time I push something in my Git A/c with help of jenkins and sauce labs in the ec2 server.
There are lots of ways to do this. What do you know about Amazon EC2? And Selenium? And Docker? There are lot's of technologies here... Do you want to configure a Selenium grid? I'll try to answer some of this. But you are asking so many things... xD
I'll tell you my solution (Selenium grid) on that first:
First of all you need to create a Selenium hub with an EC2 ubuntu 14.04 AMI without UI and link it as a jenkins slave to your Jenkins master. Or as directly a master. What you want. Only command line. Download Selenium Server standalone. (be careful on downloading the version. If you Download the Selenium3Beta, things could change). Here you can configure the HUB. You can also add the Selenium Hub as a service and configure to run automatically at server start. its important that you open the Selenium default port (or the one that you configured) so the nodes can connect to it. You can do that on the Amazon EC2 console when you have created your instance. You just need to add a security group with an inbound rule for TCP in the port you want for the IPs you want.
Then, you can create a Windows server 2012 instance server (for example, that's what I did), and do the same process. Download the same version for Selenium and the chromedriver (there is no need to download any firefoxdriver for Selenium versions before Selenium3). Generate a txt file and prepare the Selenium command to link to the HUB as a NODE. And convert it to *.bat in order to execute it. If you want to run the bat at start you can create a service with the task scheduler or use NSSM (https://nssm.cc/). Don't forget to add the rules to the security groups for this machine too!
You can link as many servers as you want to your node.
If you want to use docker, good luck! ;) Haha.
No, with docker I recommend you to start as easy as posible trying to create a Dockerfile in local that runs the Jenkins server and the Selenium Server NOT in grid mode. When you have it working in local, push it to a repository. When You have all of this running, create an EC2 instance and install docker. Pull your selenium docker image and run it linking the local server ports to the docker machine ports.
You have so many work to do here... But it's so interesting. I recommend you go step by step creating in every iteration a better infrastructure. Don't try to add all that technologies at the same time.
Thera are lots of webs talking about that concepts.
Good luck!

PHP exec() , showing executed exe file in task manager but not displaying

i have used simple PHP script to execute exe file through php script, below is my PHP code
<? exec('"C:\Windows\notepad.exe"');?>
my problem is, when i check task manager after executing above code, notepad.exe is there but it is not diplaying
same way if i execute below mentioned code
<? exec('"C:\Program Files\WinSCP\WinSCP.exe"'); ?>
task manager shows WinSCP.exe, but winscp is not diplaying
can anyone tell me why applications are not showing ?
Whatever your web server is (Apache, Nginx, IIS...) it's clearly not configured to run with the credentials of your administrator user account. That's the sensible default. Background services are designed to run unattended.
You have several choice, from worse to better:
Kill security in your web server configuration. If web server runs as service, open Windows Service Manager and configure it to run with your account (don't forget to come back here if you change your password in the future). This way you allow any stranger in your computer, local network and/or internet to run programs in your name, in this case Notepad and WinSCP.
If the web server allows it, run it from a command-prompt in your own session. It's similar to #1 but will at least not run 24/7.
Any of the above, with a restricted account.
Don't use a web server. PHP can run from the command-line just fine, what means that you can even create a *.bat file and assign an icon to it.
As about your code, when it finally works your script will sleep until you close Notepad. This can be a bug or a feature depending on your needs.
Had the same problem with WAMP 2.4 & windows XP, the following helped:
Win+R, services.msc
edit wampapache and wampmysqld to allow affecting desktop.
Alternatively you can try:
Win+R, services.msc
edit wampapache and wampmysqld to log on as the same user.

How to run an php application without installing xampp on client system?

In my application i have to deploy my application on client system.
So is there any way to run my php application without installing xampp...
Because the client should access it as a readymade app without installing anything...
This is the description of my project...
We have to develop an application where the client will have our application he will connect to remote server
Then he will download the data from remote server...
Then he uses that downloaded data using that app
Here my requirement is the user may not have the knowledge of installing the xampp...
So is there any way to run the application in user system just by copying some files
U may suggest me a one click solution (like using installer which will include installation of xampp and copying my data into user system)
I really dont want to use any external software to render no database PHP pages so I did some digging and found that if you run php -S localhost:port in your working directory you basically start a server there.
S is a capital S and not s
I'm a big fan of server2go. I've used it to deploy PHP applications on CD/DVD. It comes with MySQL and is relatively easy to configure. I've even replaced their splash screen with my own so no one knows I'm using it. It's donationware, but I was impressed enough to donate:
server2go-web
With this application, you don't have to install all that other stuff. It's self-contained in this executable and directory.
EDIT: To clarify, server2go does not install anything on the client machine. It runs as an exe only when you specifically want it to. When you click on the .exe file, it launches your PHP application in a browser window, then you can right-click on the server2go icon in the system tray and close it when you're done.
EDIT2: One gotcha: if you want to save data to the MySQL db on the client machine, you'll need to copy serve2go to a directory on the client machine or run it on a writable USB stick. If you run this application off CD/DVD, it will be able to read data from the database, but not write.
The better way is to use PHP Desktop Application. It will allow you to run your PHP Script like a Desktop application and you don't need to install Xampp or any other web server to run.
PHP Desktop Application
After downloading the .Zip file unzips it to any folder that you like. After unzipping, Go to the folder, and there you can see a folder "www". Delete all the files contained in it and move all your php script to it.
Once you moved all your files into it. Run the .Exe file named "PHP desktop-chrome"
It will open your PHP Script really like a Desktop Application.
This script doesn't require any kind of server software like Xampp, Wamp, Etc installed in your PC.
You can either host the php application or install the application into one system as server and call in client system using the ip of the server system like the following
http://**ip address/php file name
If you don't want your client to install anything then you should create Client Server architecture, there is no another way.
PHP Application are not meant to be deployed on multiple clients. It's meant to be deployed on a webserver (your own server with sth. like IIS or XAMPP) so the clients can access it via their browser and doesn't have to install anything more.
If you want to deploy applications on the client pc's i recommened an other programming language like Java or C/C++.
I simply used xampp zip version so i copied my application into htdocs and the whole xampp is given to the customer so he simply running the application eazily without installation.
Make sure you have installed php from https://www.php.net/downloads.php. Once installed add it to path. Lastly type php -S localhost:8000
PHP needs to be installed on the machine it is running at in order to make sure it works. Since the app may grow and may require extension installing, PHP upgrading over time, hosting this on a client machine is not a very easy task in terms of management. You may want to host your project on a server and write a small bash script sending requests to the API.
If, for some reason you cannot host this on a server where your clients would send requests via the bash scripts, then you may want to install only PHP. If it does not need to listen to HTTP requests, then you do not need a server, you can just implement the PHP application and create a bash script so the user will be able to run it from the UI of their operating system.
No, you need some kind of server - Wamp, Xampp, etc.
You can host it online, and then he can just browse it from his PC.

Categories