January 11, 2008
Now, after getting Zend Debugger to work, trying to run a .php file in BBEdit using #!/usr/bin/php results in the following error:
dyld: NSLinkModule() error
dyld: Symbol not found: _OnUpdateInt
Referenced from:
/Applications/Zend/ZendStudio-5.5.0/lib/php4/ZendDebugger.so
Expected in: flat namespace
This is caused by those new lines in /etc/php.ini (see previous post).
But Zend Debugger needs that configuration, so the fix is to put an empty php.ini into /usr/bin. This allows BBEdit to work around the problem.
Leave a Comment » |
Uncategorized |
Permalink
Posted by macenable
January 6, 2008
ZendDebuggerLocal.so, an extension supplied with Zend Studio, doesn’t work in server mode. Checking the environment using phpinfo shows Zend Debugger v5.2.12 is disabled. Also, the file dummy.php is empty.
A different extension and dummy.php file is found online. ZendDebugger.so goes into Zend’s lib/php4 directory, and the new and different dummy.php goes into localhost’s root directory.
Next, insert the following data into /etc/php.ini, showing the interpreter where the extension can be found:
zend_extension=/Applications/Zend/ZendStudio-5.5.0/lib/php4/ZendDebugger.so
zend_debugger.allow_hosts=127.0.0.1/32
session.save_path=/Applications/Zend/ZendStudio-5.5.0/tmp
Also, because MySQL is installed on localhost and can’t be reached internally, change the debug mode to server:
Zend Studio > Preferences > Debug > Debug Mode: Server
Leave a Comment » |
Uncategorized |
Permalink
Posted by macenable
December 29, 2007
<?php
if ($a > 0) {
echo "a is positive";
}
elseif ($a < 0) {
echo "a is negitive";
}
else {
echo "a is zero";
}
?>
<?php
if ($a > 0) : echo "a is positive";
elseif ($a < 0) : echo "a is negitive";
else : echo "a is zero";
endif;
?>
Leave a Comment » |
Uncategorized |
Permalink
Posted by macenable
December 15, 2007
Simplify connecting by creating a directory containing a symbolic link in the /var/mysql directory, where PHP looks for it by default. MySQL installs it by default in the /tmp directory:
shell> sudo mkdir /var/mysql
shell>sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Updating /etc/my.cnf or /etc/php.ini are two other solutions.
Leave a Comment » |
Uncategorized |
Permalink
Posted by macenable
December 14, 2007
#!/usr/bin/php
<?
$theArray = getrusage();
foreach ($theArray as $key => $value) {
print(“$key\t$value\n”);
}
?>
or
<HTML>
<HEAD>
<TITLE>PHP – Key Value Usage</title>
</HEAD>
<BODY>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=5>
<?
$theArray = getrusage();
foreach ($theArray as $key => $value) {
print(“<TR><TD>$key</TD><TD>$value</TD></TR>”);
}
?>
</TABLE>
</BODY>
</HTML>
Leave a Comment » |
Uncategorized |
Permalink
Posted by macenable
December 14, 2007
<html>
<head>
<title>PHP – For Each Array Item</title>
</head>
<body>
<?
$theArray = array(‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’);
foreach ($theArray as $theItem) {
echo $theItem.”<BR>”;
}
?>
</body>
</html>
When foreach first starts executing, the internal array pointer is automatically reset to the first element of the array; there’s no need to call reset() before a foreach loop.
Leave a Comment » |
Uncategorized |
Permalink
Posted by macenable