How to Work with PHP programs on Mac OS X

The Mac OS X operating system comes pre-installed with the libraries needed to run PHP programs. You can interact with PHP programs via the Terminal application (Applications -> Utilities -> Terminal). You can also use the built-in web server that comes with Mac OS X, the Apache web server, to execute PHP programs. For more information on running PHP via the local web server, see the following:

Running PHP on Apache for Mac

 

PHP programs can be created using any text editor such as EditRocket. PHP programs and scripts typically end with the .php extension. EditRocket will automatically recognize files with the .php extension as PHP programs, and will color the syntax accordingly.

 

To create a PHP program, simply create a new file, such as hello.php. In the file, place the following:

<?php
 echo "Hello, world!";
?>

 

 

The above program can be executed using the EditRocket Tools -> PHP -> Execute Program option, or you can execute it from the Terminal window. To execute the script in the Terminal, use the cd command to cd to the directory where the hello.php file was saved, such as

cd /Users/user/Desktop 

 
Then type the following:

php hello.php 

 
Hello World! should then be printed to the screen.

 

from: http://www.editrocket.com/articles/php_mac_os_x.html

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值