Is running PHP & MySQL on a Mac different to Ubuntu/Windows
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.
You have to enclose php code within
<?php ?>
all the time for Windows, but on Ubuntu you can use<? ?>
On Windows, when you name a database table as tblMyTable, it changes into tblmytable (all lowercase).
Crons are differently specified on Windows and Ubuntu.
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.
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?>"Francois' link to MySQL docs was perfect (+1): Identifier Case Sensitivity
OS X comes with cron just like Linux. You can view your crontab with
crontab -l
and edit withcrontab -e
It's good practice to be consistent about your filename case, whether or not the operating system enforces it.
精彩评论