How to run php programs on local computer?
kitepilot at kitepilot.com
kitepilot at kitepilot.com
Wed Jul 3 14:14:00 MST 2013
Joe, download and run locally this little dummy PHP app:
http://www.html-form-guide.com/php-form/php-registration-form.html
You'll need a fully functional LAMP stack which will allow you to run your
test program too.
BE CAREFUL to insure that your 'test program' doesn't access live data.
It may not be as trivial as it looks...
Regarding:
> #!/bin/php (whatever 'which php' resolves to...)
You can run shell scripts in PHP.
That line is just telling the to use the PHP interpreter just as:
#!/bin/bash
would use, well... the bash interpreter! :)
Enjoy!
ET
joe at actionline.com writes:
> == Joe asked:
>>> What do I need to do to be able to run php programs
>>> on my local linux computer?
>>> It's a nuisance to have to upload programs to my
>>> web host to test small changes.
>
> == kitepilot replied: If they are WEB:
> Install Apache in your box and run from http://localhost/
> If they are 'shell', make sure that the first line is:
> #!/bin/php (whatever 'which php' resolves to...)
>
> == J: Sorry I'm so lame, but I don't understand this.
>
> == Keith replied: If you are doing any data stuff,
> you will have to pull in MySql as well.
>
> == J: I hope to avoid MySql, keep it simple and just use text files.
>
> == Matt replied: Search the Net for "$DISTRO apache php setup"
> There are (usually) default configurations in distro
> packages that make running a simple setup easy.
> - Once done, put PHP code within .php files in some dir
> under /var/www/localhost/ . Then go to
> http://localhost/myfile.php in a browser should execute
> that PHP code and display the results in that browser.
>
> - (example) On CentOS/RHEL, you would do:
> yum install httpd php53 php53-mysql
> /etc/init.d/httpd start
> # optional, but makes apache always starts on boot
> chkconfig httpd on
>
> == J: Thanks for all the replies. Matt, you always provide
> especially valuable guidance. Simple setup is what I need ;)
> Which is optional? '/etc/init.d/httpd start' or 'chkconfig'?
> I find no man entry for 'chkconfig'
>
> I've been searching the 'net and trying to read and learn
> how PHP works, but I still don't understand how to put
> the php and html components together; or if they should
> be in separate files or integrated into one.
>
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
More information about the PLUG-discuss
mailing list