I'm having a very strange problem. My app is causing my server to go berserk.
My iOS app uses TFHPPLE to parse data from a php page on my server. It grabs a name from the page, and checks how much time remains for that campaign.
NSString *URL1 = #"http://alefdev.com/tzedakah/current.php";
NSData *webPage = [NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat: URL1]]];
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:webPage];
NSArray *elements = [xpathParser search:#"//name"];
if([elements count] == 0)
{
NSLog(#"array is empty");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Connection Error" message:#"Cannot connect to server."
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
[alert release];
[adupdate invalidate];
rc.enabled = YES;
rc.hidden = NO;
}
else{
TFHppleElement *element = [elements objectAtIndex:0];
NSString *ttl = [element content];
NSLog(#"Charity Name: %#", ttl);
todayscharity.text = ttl;
}
Every 10 seconds, it calls to the server, grabs the info it needs, and puts it into an array. If the array is empty, the timer is invalidated, and a 'Reconnect' button appears. The 'Reconnect' button restarts the timer.
The timer:
-(void)starttimer{
adupdate = [NSTimer scheduledTimerWithTimeInterval:(10.0) target:self selector:#selector(updateAd) userInfo:nil repeats:YES];
NSLog(#"starttimer called");}
The restart function
- (IBAction)reconnect:(id)sender
{
[self starttimer];
}
If it fails (empty array) and then restarts, it tries again to grab info from my servers, but cannot. The entire site gives a Internal Server Error (500).
The php script gets the current date
$today = getdate();
$todayfull = $today['year'].$today['mon'].$today['mday'];
Checks the date:
if(($todayfull == 201192)||($todayfull == 201193))
Then echoes some text and runs the countdown function after matching the day.
function countdown($year, $month, $day, $hour, $minute)
{
$the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);
$today = time();
$difference = $the_countdown_date - $today;
if ($difference < 0) $difference = 0;
$days_left = floor($difference/60/60/24);
$hours_left = floor(($difference - $days_left*60*60*24)/60/60);
$minutes_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60)/60);
if($minutes_left < 1)
{
echo "<ends>Less than 1 minute</ends>";
}
else{
echo "<ends>".$days_left." day ".$hours_left." hours ".$minutes_left." minutes</ends>";
}
Error Logs show:
[Sun Sep 4 14:01:53 2011] [error] [client 184.100.79.143] File does not exist: /home/alefdev2/public_html/error_500.htm
[Sun Sep 4 14:01:53 2011] [error] [client 184.100.79.143] Premature end of script headers: /home/alefdev2/public_html/tzedakah/current.php
[Sun Sep 4 14:01:43 2011] [error] [client 184.100.79.143] File does not exist: /home/alefdev2/public_html/error_500.htm
[Sun Sep 4 14:01:43 2011] [error] [client 184.100.79.143] Premature end of script headers: /home/alefdev2/public_html/tzedakah/current.php
[Sun Sep 4 14:01:43 2011] [error] [client 184.100.79.143] File does not exist: /home/alefdev2/public_html/error_500.htm
[Sun Sep 4 14:01:43 2011] [error] [client 184.100.79.143] Premature end of script headers: /home/alefdev2/public_html/tzedakah/current.php
[Sun Sep 4 14:00:25 2011] [error] [client 184.100.79.143] File does not exist: /home/alefdev2/public_html/error_500.htm
The full php script is:
<?php
$today = getdate();
$todayfull = $today['year'].$today['mon'].$today['mday'];
echo "Todayfull: $todayfull";
if(($todayfull == 201192)||($todayfull == 201193))
{
echo "<name>The Lone Soldier Center in memory of Michael Levin</name>
<description>Lone Soldier Center desc.</description>
";
countdown(2011,9,4,0,0);
}
else if(($todayfull == 201194)||($todayfull == 201195)){
echo "<name>Friends of Itamar</name>
<description>Friends of Itamar desc.</description>
";
countdown(2011,9,6,0,0);
}
else{
echo "Error: Could not match dates.";
}
?>
<?php
function countdown($year, $month, $day, $hour, $minute)
{
$the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);
$today = time();
$difference = $the_countdown_date - $today;
if ($difference < 0) $difference = 0;
$days_left = floor($difference/60/60/24);
$hours_left = floor(($difference - $days_left*60*60*24)/60/60);
$minutes_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60)/60);
if($minutes_left < 1)
{
echo "<ends>Less than 1 minute</ends>";
}
else{
echo "<ends>".$days_left." day ".$hours_left." hours ".$minutes_left." minutes</ends>";
}
}
?>
My host (SiteGround) said that I just had too many IMAP processes running, but the site only ever crashes if I try to reconnect thru this app.
There's two things going on. First, you're getting too many calls to the server, so I think your timer invalidation isn't working right. Second, your PHP script isn't putting out proper header, so you're getting server errors.
Related
I've developed an API which originally was only used via a browser and never noticed an issue however, I am now trying to connect to it via a third party Android library (OkHttpClient) and I've tested what I am seeing using a REST API test client (Insomnia.rest).
The problem I am having is when I perform the login action of the API I start a session and call session_regenerate_id(true); to avoid sticky session attacks (I'm not sure if that's proper name).
However, when I do this I return two PHPSESSID cookies as shown in the headers below:
< HTTP/1.1 200 OK
< Date: Thu, 18 Apr 2019 22:51:43 GMT
< Server: Apache/2.4.27 (Win64) PHP/7.1.9
< X-Powered-By: PHP/7.1.9
* cookie size: name/val 8 + 6 bytes
* cookie size: name/val 4 + 1 bytes
< Set-Cookie: ClientID=413059; path=/
* cookie size: name/val 9 + 26 bytes
* cookie size: name/val 4 + 1 bytes
< Set-Cookie: PHPSESSID=15u9j1p2oinfl5a8slh518ee9r; path=/
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
* cookie size: name/val 9 + 26 bytes
* cookie size: name/val 4 + 1 bytes
* Replaced cookie PHPSESSID="hkkffpj8ta9onsn92pp70r257v" for domain localhost, path /, expire 0
< Set-Cookie: PHPSESSID=hkkffpj8ta9onsn92pp70r257v; path=/
* cookie size: name/val 17 + 1 bytes
* cookie size: name/val 4 + 1 bytes
< Set-Cookie: UsingGoogleSignIn=0; path=/
* cookie size: name/val 6 + 1 bytes
* cookie size: name/val 4 + 1 bytes
< Set-Cookie: UserID=7; path=/
< Access-Control-Allow-Credentials: true
< Content-Length: 47
< Content-Type: application/json
As you can see from the above output there's two Set-Cookies with PHPSESSID. If I remove the session_regenerate_id I then only get the one PHPSESSID cookie and then the Android client successfully works.
I've exhibited this on Apache under Wamp on Windows 10 and Apache in production on a CentOS 7 build.
So question is, how can I generate a new PHP session ID without sending back two different PHPSESSID cookies?
UDPATE
Below is some of the code relating to the login process. I can't include all of the code but it should show the concept of what is going on.
An API request is made to the login function
$email = mysqli_escape_string($this->getDBConn(), $encryption->encrypt($postArray["email"]));
$password = mysqli_escape_string($this->getDBConn(), $encryption->encrypt($postArray["password"]));
$externalDevice = isset($postArray["external_device"]) ? abs($postArray["external_device"]) : 0;
$query = "SELECT * FROM users WHERE Email='$email'";
$result = $this->getDBConn()->query($query);
if ($result)
{
if (mysqli_num_rows($result) > 0 )
{
$myrow = $result->fetch_array();
if ($myrow["UsingGoogleSignIn"] === '1')
{
//We're trying to login as a normal user, but the account was registered using Google Sign In
//so tell the user to login via google instead
return new APIResponse(API_RESULT::SUCCESS, "AccountSigninViaGoogle");
}
else
{
//Check the password matches
if ($myrow["Password"] === $password)
{
$this->getLogger()->writeToLog("Organisation ID: " . $myrow["Organisation"]);
$organisationDetails = $this->getOrganisationDetails(abs($myrow["Organisation"]), false);
$this->getLogger()->writeToLog(print_r($organisationDetails, true));
$this->createLoginSession($myrow, $organisationDetails, false, $paymentRequired, $passwordChangeRequired);
$data = null;
if ($externalDevice === 1)
{
$data = new stdClass();
$data->AuthToken = $_SESSION["AuthToken"];
$data->ClientID = $_SESSION["ClientID"];
$data->UserID = abs($_SESSION["UserID"]);
}
$this->getLogger()->writeToLog("Login Response Headers");
$headers = apache_response_headers();
$this->getLogger()->writeToLog(print_r($headers, true));
At this point an API response is returned which contains JSON object
In the code above, if the email and password matches (not using Google sign in here) it calls createLoginSession which is the following:
private function createLoginSession($myrow, $organisationDetails, $usingGoogleSignIn, &$paymentRequired, &$passwordChangeRequired)
{
require_once 'CommonTasks.php';
require_once 'IPLookup.php';
require_once 'Encryption.php';
try
{
$this->getLogger()->writeToLog("Creating login session");
$paymentRequired = false;
if ($organisationDetails === null)
{
$organisationDetails = $this->getOrganisationDetails($myrow["Organisation"]);
}
$encryption = new Encryption();
$userID = mysqli_escape_string($this->getDBConn(), $myrow["UserID"]);
$organisationID = intval(abs($myrow["Organisation"]));
$commonTasks = new CommonTasks();
$browserDetails = $commonTasks->getBrowserName();
$this->getLogger()->writeToLog("Browser Details");
$this->getLogger()->writeToLog(print_r($browserDetails, true));
$clientName = $browserDetails["name"];
$iplookup = new IPLookup(null, $this->getLogger());
$ipDetails = json_decode($iplookup->getAllIPDetails($commonTasks->getIP()));
if ($ipDetails !== null)
{
$ip = $ipDetails->ip;
$country = $ipDetails->country_name;
$city = $ipDetails->city;
}
else
{
$ip = "";
$country = "";
$city = "";
}
//Create a random client ID and store this as a cookie
if (isset($_COOKIE["ClientID"]))
{
$clientID = $_COOKIE["ClientID"];
}
else
{
$clientID = $commonTasks->generateRandomString(6, "0123456789");
setcookie("ClientID", $clientID, 0, "/");
}
//Create an auth token
$authToken = $commonTasks->generateRandomString(25);
$encryptedAuthToken = $encryption->encrypt($authToken);
$query = "REPLACE INTO client (ClientID, UserID, AuthToken, ClientName, Country, City, IPAddress) " .
"VALUES ('$clientID', '$userID', '$encryptedAuthToken', '$clientName', '$country', '$city', '$ip')";
$result = $this->getDBConn()->query($query);
if ($result)
{
session_start();
$this->getLogger()->writeToLog("Logging in and regnerating session id");
session_regenerate_id(true);
$_SESSION["AuthToken"] = $authToken;
$_SESSION["ClientID"] = $clientID;
$_SESSION["UserID"] = $userID;
$_SESSION["FirstName"] = $this->getEncryption()->decrypt($myrow["FirstName"]);
$_SESSION["LastName"] = $this->getEncryption()->decrypt($myrow["LastName"]);
$passwordChangeRequired = $myrow["PasswordChangeRequired"] === "1" ? true : false;
//Check if the last payment failure reason is set, if so, set a cookie with the message but only
//if the organisation is not on the free plan
//Logger::log("Current Plan: " . $this->getOrganisationDetails(->getPlan()));
if ($organisationDetails->getPlan() !== "Free")
{
if (!empty($organisationDetails->getLastPaymentFailureReason()))
{
$this->getLogger()->writeToLog("Detected last payment as a failure. Setting cookies for organisation id: " . $organisationDetails->getId());
setcookie("HavePaymentFailure", true, 0, "/");
setcookie("PaymentFailureReason", $organisationDetails->getLastPaymentFailureReason(), 0, "/");
}
//Check if the current SubscriptionPeriodEnd is in the past
$subscriptionPeriodEnd = $organisationDetails->getSubscriptionOfPeriod();
$currentTime = DateTimeManager::getEpochFromCurrentTime();
if ($currentTime > $subscriptionPeriodEnd)
{
$this->getLogger()->writeToLog("Detected payment overdue for organisation: " . $organisationDetails->getId());
//The payment was overdue, determine the number of days grace period (there's a 7 day grace period) that's left
$subscriptionPeriodEndGracePeriod = $subscriptionPeriodEnd + (86400 * 7);
$numberOfDaysRemaining = floor((($subscriptionPeriodEndGracePeriod - $currentTime) / 86400));
setcookie("PaymentOverdue", true, 0, "/");
setcookie("DaysGraceRemaining", $numberOfDaysRemaining, 0, "/");
if ($numberOfDaysRemaining <= 0)
{
$paymentRequired = true;
}
}
}
setcookie("UsingGoogleSignIn", $usingGoogleSignIn ? "1" : "0", 0, "/");
if ($organisationDetails->getId() !== 0)
{
$_SESSION["OrganisationDetails"] = array();
$_SESSION["OrganisationDetails"]["id"] = $organisationDetails->getId();
$_SESSION["OrganisationDetails"]["Name"] = $organisationDetails->getName();
}
setcookie("UserID", $userID, 0, "/");
$this->getLogger()->writeToLog("Successfully created login session. User ID '$userID' and Organisation ID '$organisationID'");
return true;
}
else
{
$error = mysqli_error($this->getDBConn());
$this->getLogger()->writeToLog("Failed to create login session. DB Error: $error");
$this->getAlarms()->setAlarm(AlarmLevel::CRITICAL, "AccountManagement", "Failed to create login session. DB Error");
throw new DBException($error);
}
}
catch (DBException $ex)
{
throw $ex;
}
}
In the function above I call session_start() and then regenerate_session_id() and I then get the two PHPSESSID cookies in the response although the log line is only outputted once so its definetely not getting called multiple times.
If I remove regenerate_session_id then the problem goes away. To be safe I've tried swapping the session_start() so it comes after regenerate_session_id but that looks like the session id doesn't get re-created as expected.
UPDATE 2
From the comment from #waterloomatt I've created a PHP script that just has the following:
<?php
session_start();
session_regenerate_id(true);
phpinfo();
and the HTTP header information outputted from phpinfo is as follows
**HTTP Request Headers**
GET /api/session_test.php HTTP/1.1
Host localhost
Connection keep-alive Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36
Accept text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding gzip, deflate, br
Accept-Language en-GB,en-US;q=0.9,en;q=0.8
Cookie _ga=GA1.1.1568991346.1553017442
**HTTP Response Headers**
X-Powered-By PHP/7.2.10
Set-Cookie PHPSESSID=i19irid70cqbvpkrh0ufffi0jk; path=/
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache,> must-revalidate Pragma no-cache
Set-Cookie PHPSESSID=48qvia5e6bpmmk251qfrqs8urd; path=/
This header will actually remove cookie. This is the only way to remove HTTP-only cookie: to make it expire backdate.
Set-Cookie: PHPSESSID=15u9j1p2oinfl5a8slh518ee9r; path=/
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
I think I've figured out what's going on. I thought it a cookies expires it will be all on the same line but it looks like - at least the way I'm passing the cookie strings that the cookies expiry is a different line.
I've therefore changed how I parse the cookie string so if it there's expire on the next line I don't include the cookie which seems to work. Below is how I am passing the cookies and not including the cookie if its expired:
for (int i = 0; i < headers.length; i++)
{
Log.d("BaseAPI", "Header: " + headers[i]);
if (headers[i].trim().toLowerCase().startsWith("set-cookie:"))
{
if (headers[i+1].toLowerCase().startsWith("expires"))
{
Log.d("BaseAPI", "Found expired header. The cookie is: " + headers[i+1]);
//Thu, 19 Nov 1981 08:52:00 GMT
long epoch = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss").parse(headers[i+1].replace("Expires: ", "").replace("GMT", "").trim()).getTime();
Log.d("BaseAPI", "Cookie Epoch: " + epoch);
long currentEpoch = new Date().getTime();
Log.d("BaseAPI", "Current Epoch: " + currentEpoch);
if (epoch < currentEpoch)
{
continue;
}
}
cookieBuilder.append(headers[i].trim().replace("Set-Cookie:", "").replace("path=/", ""));
cookieBuilder.append(" ");
}
}
This is a known and documented issue.
Just call session_regenerate_id() without passing true.
The manual clearly says that you should not delete old session data if you want to avoid racing condition and also concurrent access may lead to inconsistent state.
See https://www.php.net/manual/en/function.session-regenerate-id.php
for more info
Looked over some answers here but nothing seems to work..
I'm new to PHP and trying to upload multiple files from a form that's inside a jquery bootbox dialog..
here's my form:
function dialogUpload() {
bootbox.confirm({
message: '<form name="uploadForm" action="Control/upload.php" method="post" enctype="multipart/form-data"> '
+ ' Nome do objeto:<br />'
+ ' <input name="objectname" type="text"><br />'
+ ' <input type="hidden" name="MAX_FILE_SIZE" value="10000000">'
+ ' Objeto 3D(Formato <b>.dae</b>):<br />'
+ ' <input name="userfile[]" type="file" /><br />'
+ ' Imagem 2D do objeto(Formato <b>.png</b> ou <b>.jpg</b>) (<i>Opcional</i>):'
+ ' <input name="userfile[]" type="file" /><br />'
+ ' Comentário:<br />'
+ ' <textarea name="comment" rows="5" cols="75"></textarea>'
+ '</form>',
buttons: {
confirm: {
label: 'Enviar Arquivo',
className: 'btn-success'
},
cancel: {
label: 'Cancelar',
className: 'btn-danger'
}
},
callback: function (result) {
if(result){
document.uploadForm.submit();
}
}
});
}
and heres my PHP, it just create a random file name and check the file extensions...than upload the file to respective folder.
Running on Windows 10, with XAMPP(don't know if it's relevant)
<?php
include '../Model/conexao.php';
include 'funcoes.php';
echo '<script>alert("Upload script started.");</script>';
$uploadIsOk = TRUE;
$imageUploaded = FALSE;
$targetObjectDirectory = "C:\xampp\htdocs\importaobjetos\uploads\objects";
$targetImageDirectory = "C:\xampp\htdocs\importaobjetos\uploads\images";
$fileName = createFileName($targetObjectDirectory);
$targetObjectFile = $targetObjectDirectory . basename($_FILES["userfile"][0]["name"]);
$targetObjectFileType = pathinfo($targetObjectFile, PATHINFO_EXTENSION);
if($_FILES["userfile"][1]["name"] != ""){
$targetImageFile = $targetObjectDirectory . basename($_FILES["userfile"][1]["name"]);
$targetImageFileType = pathinfo($targetImageFile,PATHINFO_EXTENSION);
$imageUploaded = TRUE;
}
$errorMessage = '<script>alert("';
$successMessage = '<script>alert("';
checkExtensions();
replaceOriginalFileName();
if(!$uploadIsOk){
$errorMessage = $errorMessage . 'Erros occoridos estão acima, upload não foi feito.';
$errorMessage = $errorMessage . '");</script>';
echo $errorMessage;
}
else{
//Tudo certo, fazer upload
if(move_uploaded_file($_FILES["userfile"][0]["tmp_name"], $targetObjectFile)){
$successMessage = $successMessage . 'Upload do objeto foi feito com sucesso.\n';
if($imageUploaded && move_uploaded_file($_FILES["userfile"][1]["tmp_name"], $targetImageFile))
$successMessage = $successMessage . 'Upload da imagem foi feito com sucesso.\n';
}
$successMessage = $successMessage . '");</script>';
echo $successMessage;
}
//Funcoes
function checkExtensions(){
echo '<script>alert("checkExtensions");</script>';
if($targetObjectFileType != "dae"){
$uploadIsOk = FALSE;
$errorMessage = $errorMessage . 'Formato invalido para o objeto, favor usar arquivos .dae\n';
}
if($imageUploaded){
if($targetImageFileType != "jpg" && $targetImageFileType != "jpeg" && $targetImageFileType != "png"){
$uploadIsOk = FALSE;
$errorMessage = $errorMessage . 'Formato invalido para a imagem, favor usar arquivos .jpg, .jpeg ou .png\n';
}
}
}
function createFileName($targetObjectDirectory){
$fileCreated = FALSE;
echo '<script>alert("createFileName");</script>';
while(!$fileCreated){
$fileName = "";
$size = mt_rand(5,9);
$all_str = "abcdefghijlkmnopqrstuvxyzwABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
for ($i = 0;$i <= $size;$i++){
$fileName .= $all_str[mt_rand(0,61)];
}
$filePath = $targetObjectDirectory . $fileName . '.dae';
if(checkIfExists($filePath))
$fileCreated = TRUE;
}
return $fileName;
}
function checkIfExists($filePath){
if(file_exists($filePath))
return TRUE;
else
return FALSE;
}
function replaceOriginalFileName(){
$targetObjectFile = $targetObjectDirectory . $fileName . '.' . $targetObjectFileType;
if(imageUploaded)
$targetImageFile = $targetImageDirectory . $fileName . '.' . $targetImageFileType;
else
$errorMessage = $errorMessage . 'Voce nao fez upload da imagem, será utilizada a imagem padrao.';
}
?>
things I've changed in php.ini to try to make it work...:
file_uploads = On
upload_max_filesize = 10M
max_file_uploads = 20
post_max_size = 10M
max_input_time = 360
The curious thing is that it calls the php script just after the max_input_time..then it echos the alert on the beggining of the script, and gives the error
Fatal error: Maximum execution time of 360 seconds exceeded in C:\xampp\htdocs\importaobjetos\Control\upload.php on line 113
someone can help?
EDIT:
Apache errors.log(from last trial)
[Fri Jul 14 10:34:29.219240 2017] [ssl:warn] [pid 5864:tid 664] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.275767 2017] [core:warn] [pid 5864:tid 664] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Jul 14 10:34:29.332850 2017] [ssl:warn] [pid 5864:tid 664] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.354372 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00455: Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 configured -- resuming normal operations
[Fri Jul 14 10:34:29.354372 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00456: Apache Lounge VC11 Server built: Dec 20 2016 13:02:04
[Fri Jul 14 10:34:29.354372 2017] [core:notice] [pid 5864:tid 664] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Jul 14 10:34:29.355874 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00418: Parent: Created child process 4944
[Fri Jul 14 10:34:29.754780 2017] [ssl:warn] [pid 4944:tid 632] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.929697 2017] [ssl:warn] [pid 4944:tid 632] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.953227 2017] [mpm_winnt:notice] [pid 4944:tid 632] AH00354: Child: Starting 150 worker threads.
[Fri Jul 14 10:34:42.508930 2017] [:error] [pid 4944:tid 1920] [client ::1:54421] PHP Notice: Trying to get property of non-object in C:\\xampp\\htdocs\\importaobjetos\\index.php on line 152
[Fri Jul 14 10:34:42.509446 2017] [:error] [pid 4944:tid 1920] [client ::1:54421] PHP Notice: Trying to get property of non-object in C:\\xampp\\htdocs\\importaobjetos\\index.php on line 162
when i try to get php_error_log it gives me "the system cannot find the path specified"
Do the changes as per the link WAMPServer phpMyadmin Maximum execution time of 360 seconds exceeded. Did you restarted the wamp server?
Or still same error coming?
Send me the error details.
Here's my code:
try {
if (!isset($_SESSION['E_TOKEN'])) {
$oauth_data = $oauth_handler->authorize($key, $secret, $callback);
$token = $oauth_data['oauth_token'];
$_SESSION['E_TOKEN'] = $token;
}
else
$token = $_SESSION['E_TOKEN'];
$reason = $_GET['reason'];
$client = new \Evernote\Client(array('token' => $token, 'sandbox' => true));
$advancedClient = $client->getAdvancedClient();
switch ($reason) {
case 'update':
$noteGuid = $_GET['guid'];
$noteStore = $advancedClient->getNoteStore();
$note = $noteStore->getNoteContent(array('token' => $token), $noteGuid, true, false, false, false);
}
} catch (Evernote\Exception\AuthorizationDeniedException $e) {
//If the user decline the authorization, an exception is thrown.
echo "Declined";
}
Here's the exception:
[Sat Apr 30 10:44:55.256042 2016] [:error] [pid 27190:tid 139957362468608] [client 216.104.244.35:32700] PHP Warning: strlen() expects parameter 1 to be string, array given in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Thrift/StringFunc/Core.php on line 36
[Sat Apr 30 10:44:55.599976 2016] [:error] [pid 27190:tid 139957362468608] [client 216.104.244.35:32700] PHP Fatal error: Uncaught exception 'EDAM\Error\EDAMUserException' in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php:3202\nStack trace:\n#0 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(717): EDAM\UserStore\UserStore_getNoteStoreUrl_result->read(Object(Thrift\Protocol\TBinaryProtocol))\n#1 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(678): EDAM\UserStore\UserStoreClient->recv_getNoteStoreUrl()\n#2 [internal function]: EDAM\UserStore\UserStoreClient->getNoteStoreUrl(Array)\n#3 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/Store/Store.php(38): call_user_func_array(Array, Array)\n#4 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/AdvancedClient.php(69): Evernote\Store\Store->__call('getNoteStoreUrl', Array)\n#5 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/AdvancedClient.php(69): Evernote\S in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php on line 3202
Note the error log entry for Core.php at line 36 expecting a string instead of an array.
Any suggestions?
this is my config:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 86400; //1 day
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 86400; //1 day
I don't know why my session_id changes whenn im dealing with some records.
Here's the error log of the record that the session_id doesn't change (which is correct) (AJAX post):
[Thu Mar 19 14:26:14.080447 2015] [:error] [pid 7902] [client 192.168.10.126:58565] f83e35227ac23f60d175dbbb333f9554 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=1129
[Thu Mar 19 14:26:15.516590 2015] [:error] [pid 7902] [client 192.168.10.126:58565] f83e35227ac23f60d175dbbb333f9554 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=1129
Here's the error log of the record that the session_id changes (which is NOT correct) (AJAX post):
[Thu Mar 19 14:25:42.260545 2015] [:error] [pid 7590] [client 192.168.10.126:58512] 3ff5478a950d3f0d5d71f3c72d1102a0 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=28453
[Thu Mar 19 14:25:47.322896 2015] [:error] [pid 7511] [client 192.168.10.126:58521] 5a7f2424717505a2a68ffe717e56971b <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=28453
I'm using the same steps for both. I'm not sure when and why the session_id changes when I'm dealing with some records on back-end. I believe that my config is correct.
Additional info:
var opt;
function showPreviewMode(div,section,editmode){
showModalElement('pleasewait');
jQuery.ajax({
url:"update_listings_controller/get_listing_content/<?php echo $this->input->get('listingId'); ?>/"+section+"/"+editmode,
success:function(data){
jQuery(div).html(data);
hideModalElement('pleasewait');
masking();
if(section == 3){
opt = new OptionTransfer("serviceArea", "serviceAreaIds");
opt.setAutoSort(true);
opt.setDelimiter(",");
opt.saveNewRightOptions("newRight");
var dol = new DynamicOptionList("serviceAreaLeft");
opt.init(document.whoDoTheyServe);
}else if(section== 4){
disAbledFee();
disabledMeds();
privatePay();
}else if(section== 5){
checkDay();
waitList();
}
}
});
}
This is just what I did:
instead of calling $this->session->userdata('session_id'),
I'm just calling this:
session_id();
They don't have same value, session_id(); is not changing anyway.
i was programming a mail templatingsystem. The user should be able to use markers in there, they will be replaced by the actual data. The problem ist, my function to replace the markers works just fine, but i need to do a recursiv call of that function, that will only run once, and this is what i came up with:
public function replace_placeholders($content, $recipient, $settings, $interface, $recommendation, $format, $recursion = false) {
$content = $this->replace_ph('briefanrede' , $recipient['id'] , $content);
$content = $this->replace_ph('anrede' , $recipient['title'] , $content);
$content = $this->replace_ph('email' , $recipient['email'] , $content);
$content = $this->replace_ph('kundennummer' , $recipient['kdnumber'] , $content);
$content = $this->replace_ph('briefanrede' , $recipient['briefanrede'] , $content);
if($recipient['title'] == $settings['anrede_w'] || $recipient['title'] == $settings['anrede_m']) {
$content = $this->replace_ph('vorname' , $recipient['forename'] , $content);
$content = $this->replace_ph('nachname' , $recipient['surename'] , $content);
} else {
$content = $this->replace_ph('vorname' , "" , $content, true);
$content = $this->replace_ph('nachname' , "" , $content, true);
}
$content = $this->replace_salutation($recipient, $settings, $content);
//Recommendation
if($this->need_replacement($content, 'weiterempfehlung') === false && $recursion === false) {
if($recommendation['own_page'] == 1) {
$baseurl = $recommendation['location'];
} else {
$baseurl = $recommendation['link'];
}
$pattern = ($format == "html") ? '%s' : '%s';
$url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface, $recommendation, true);
$content = $this->replace_ph('weiterempfehlung' , (($format == "html") ? sprintf($pattern, $url, $settings['text_weiterempfehlung']): sprinf($pattern, $url)), $content);
}
return $content;
}
The recursiv call in this line
$url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface, $recommendation, true);
is causing a 500 internal server error. I dont know why, because i think that i limited the recursion to run once. Can you help me out?
Sorry for my bad english i try hard to write clear sentences.
//EDIT:
Apache log:
[Wed May 30 15:31:56 2012] [warn] [client xx.xxx.xx.xxx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed May 30 15:31:56 2012] [warn] [client xx.xxx.xx.xxx] (104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
[Wed May 30 15:31:56 2012] [error] [client xx.xxx.xx.xxx] File does not exist: /var/www/web80/html/web80-newsletter/favicon.ico
[Wed May 30 15:31:58 2012] [error] mod_fcgid: process /var/www/php-fcgi/web80.php53/php-fcgi(21975) exit(communication error), get unexpected signal 11
the php errorlog is empty.
It would seem you miss one argument in your recursive call, making the $recursive = false continue being false all the time, which in turn makes your if statement
if($this->need_replacement($content, 'weiterempfehlung') === false && $recursion === false)
always return true.
Try adding one last variable to your recursive call instead and you should be able to properly execute your script, ie:
$url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface,
$recommendation, true, true);
^ added one true
What i think you want to add instead of the first true is $format.
Signal 11 is SIGSEGV, i.e. the process crashed due to a bad memory access (such as dereferencing a NULL pointer or accessing memory it was not supposed to access).
This is nothing a PHP script should be causing, so you should first upgrade to the most recent stable PHP version and if it still happens reduce your script as much as possible (remove everything that can be removed while the crash still happens) and then report it as a PHP bug.