开发者

Is running PHP & MySQL on a Mac different to Ubuntu/Windows

开发者 https://www.devze.com 2023-03-12 12:33 出处:网络
I\'ve never used a Mac for developing PHP Apps. I\'m more of an Ubunt开发者_运维问答u person. So I\'d like to know if installing & running AMP applications on a Mac is different.

I've never used a Mac for developing PHP Apps. I'm more of an Ubunt开发者_运维问答u person. So I'd like to know if installing & running AMP applications on a Mac is different.

For example, if I were to compare Ubuntu with Windows, here are some differences.

  1. You have to enclose php code within <?php ?> all the time for Windows, but on Ubuntu you can use <? ?>

  2. On Windows, when you name a database table as tblMyTable, it changes into tblmytable (all lowercase).

  3. Crons are differently specified on Windows and Ubuntu.

  4. File names on Ubuntu are case-sensitive but not on Windows.

So like this, I want to know if Ubuntu and the Mac AMP applications are different in terms of installation/operation.


Apache and PHP are the same but different operating systems (or distributions of Linux) may come with different php.ini files. I would advise against using short tags (<? or <?=) if you're planning on switching platforms or hosts as it's a configurable option.

MySQL is a different story. It stored data differently on Windows, OS X and Linux. The table names are case sensitive on Linux but not on Windows and OS X. It's actually a little more complicated than that. Have a look at http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html for all the details.

OSX can be case sensitive or not, depending on how the partition was formatted. Most OS X installation are case-insensitive. Linux distributions are definitely case sensitive.


  1. This is actually decided by a setting in your php.ini. Setting short_open_tag = On will allow you to use the short open tag "<?" instead of the long tag "<?php" on any PHP, regardless of operating system. For best portability, try to always use long tags. This includes avoiding the echo shortcut "<?=$var?>"

  2. Francois' link to MySQL docs was perfect (+1): Identifier Case Sensitivity

  3. OS X comes with cron just like Linux. You can view your crontab with crontab -l and edit with crontab -e

  4. It's good practice to be consistent about your filename case, whether or not the operating system enforces it.

0

精彩评论

暂无评论...
验证码 换一张
取 消