“[notice] child pid XXXX exit signal Segmentation fault (11)” in apache error.log [closed]

Attach gdb to one of the httpd child processes and reload or continue working and wait for a crash and then look at the backtrace. Do something like this: $ ps -ef|grep httpd 0 681 1 0 10:38pm ?? 0:00.45 /Applications/MAMP/Library/bin/httpd -k start 501 690 681 0 10:38pm ?? 0:00.02 /Applications/MAMP/Library/bin/httpd -k start … Now … Read more

Prevent Direct Access To File Called By ajax Function [duplicate]

Most Ajax requests/frameworks should set this particular header that you can use to filter Ajax v Non-ajax requests. I use this to help determine response type (json/html) in plenty of projects: if( isset( $_SERVER[‘HTTP_X_REQUESTED_WITH’] ) && ( $_SERVER[‘HTTP_X_REQUESTED_WITH’] == ‘XMLHttpRequest’ ) ) { // allow access…. } else { // ignore…. } edit: You can … Read more

No input file specified

The No input file specified is a message you are presented with because of the implementation of PHP on your server, which in this case indicates a CGI implementation (can be verified with phpinfo()). Now, to properly explain this, you need to have some basic understanding on how your system works with URL’s. Based on … Read more

PHP __get and __set magic methods

__get, __set, __call and __callStatic are invoked when the method or property is inaccessible. Your $bar is public and therefor not inaccessible. See the section on Property Overloading in the manual: __set() is run when writing data to inaccessible properties. __get() is utilized for reading data from inaccessible properties. The magic methods are not substitutes … Read more

Send file via cURL from form POST in PHP

Here is some production code that sends the file to an ftp (may be a good solution for you): // This is the entire file that was uploaded to a temp location. $localFile = $_FILES[$fileKey][‘tmp_name’]; $fp = fopen($localFile, ‘r’); // Connecting to website. $ch = curl_init(); curl_setopt($ch, CURLOPT_USERPWD, “[email protected]:password”); curl_setopt($ch, CURLOPT_URL, ‘ftp://@ftp.website.net/audio/’ . $strFileName); curl_setopt($ch, … Read more

Getting date format m-d-Y H:i:s.u from milliseconds

You can readily do this this with the input format U.u. $now = DateTime::createFromFormat(‘U.u’, microtime(true)); echo $now->format(“m-d-Y H:i:s.u”); This produces the following output: 04-13-2015 05:56:22.082300 From the PHP manual page for date formats: U = Seconds since the Unix Epoch u = Microseconds http://php.net/manual/en/function.date.php Thanks goes to giggsey for pointing out a flaw in my … Read more