MAMP “Apache couldn’t be started because port is in use.” AND “Can’t connect to local MySQL server through /tmp/mysql.sock

After restarting MAMP, I noticed the MySQL Server checkbox didn’t turn green as it usually does. I clicked ‘Start Servers’ again and got a message stating, “Apache couldn’t be started because port 8888 is in use by some other software.” Weird since I haven’t made any changes to the system or application, or installed any … Read more

Creating default object from empty value in PHP?

Your new environment may have E_STRICT warnings enabled in error_reporting for PHP versions <= 5.3.x, or simply have error_reporting set to at least E_WARNING with PHP versions >= 5.4. That error is triggered when $res is NULL or not yet initialized: PHP will report a different error message if $res is already initialized to some … Read more

Child theme css not overriding parent

This problem is most likely caused be CSS selector specificity. Essentially, the parent css rule is more narrowly tailored to hit that element than the rule you’re assigning. You can get your css to take over by using rules that are more specific than the parent css, or use the same rules, in which case … Read more

Convert from MySQL datetime to another format with PHP

If you’re looking for a way to normalize a date into MySQL format, use the following The line $phpdate = strtotime( $mysqldate ) accepts a string and performs a series of heuristics to turn that string into a unix timestamp. The line $mysqldate = date( ‘Y-m-d H:i:s’, $phpdate ) uses that timestamp and PHP’s date … Read more

What does it mean to escape a string?

Escaping a string means to reduce ambiguity in quotes (and other characters) used in that string. For instance, when you’re defining a string, you typically surround it in either double quotes or single quotes: But what if my string had double quotes within it? Now I have ambiguity – the interpreter doesn’t know where my … Read more

Object of class DateTime could not be converted to string

Because $newDate is an object of type DateTime, not a string. The documentation is explicit: Returns new DateTime object formatted according to the specified format. If you want to convert from a string to DateTime back to string to change the format, call DateTime::format at the end to get a formatted string out of your DateTime. ShareFollowa

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)