Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a server that I've setup running PHP. This serves JSON files and is running fine.

I also have several scripts that reads data from an outside source, connects to my MySQL Database Server, and runs commands to save the data to the MySQL Server.

Currently I am using Bash Scripts that are executed via Cron. Each Bash Script calls a PHP file that is saved in my normal web directory.

All of this is working fine, but I am wondering if there is a better way to do the timed scripts? Is it possible / more effective to write a Bash script that does the same thing as my PHP scripts?

Or what about Python or Ruby? I have always been confused about if Python or Ruby are for making webpages, or for making scripts that execute on the server.

I will also say that it is convenient that I can update the PHP scripts via my text editor and the changes instantly take effect - as opposed to having to connect to the server and fight with that text editor.

share|improve this question
2  
Why don't you call the PHP scripts directly? –  Michael Hampton Mar 27 '13 at 15:02

1 Answer 1

up vote 0 down vote accepted

Though PHP started out as a web-oriented language and still has native support for that, these days PHP, Ruby, and Python are all general-purpose scripting languages that can be used for a variety of purposes, including, but hardly limited to, websites.

If you already have PHP scripts doing what you want them to do, there's little reason to rewrite them in another language. As Michael Hampton's comment suggested, it's probably possible to remove the Bash wrappers entirely, since PHP is more powerful and will probably run faster once loaded. Rewriting your PHP scripts in Bash is probably not practical, but it really depends on what they're doing.

share|improve this answer
    
Thank you. I think the core of my question was if I was missing out by using PHP to write these scripts. I will look into removing the Bash wrapper. –  Chris Mar 27 '13 at 17:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.