Jump to content

arbitrageur

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by arbitrageur

  1. I'm on EC2, and for some reason my require to the Facebook PHP SDK is failing.

    require __DIR__ . '/autoload.php';
    
    use Facebook\FacebookSession;
    use Facebook\FacebookRedirectLoginHelper;
    use Facebook\FacebookRequest;
    use Facebook\FacebookResponse;
    use Facebook\FacebookSDKException;
    use Facebook\FacebookRequestException;
    use Facebook\FacebookAuthorizationException;
    use Facebook\GraphObject;
    
    use Facebook\HttpClients\FacebookCurl;
    use Facebook\HttpClients\FacebookCurlHttpClient;
    
    

    My guess is somehow it's misconfiguration, with autoload having a fatal error and silently failing. It's working on localhost, however. Any ideas, and where can I view my EC2 PHP error logs?

    Thanks

  2. So, built a classifieds site.

     

    The link is something like this: mysite.com/category/subcategory/1234

     

    The category & subcategory don't do anything, they are just for vanity.

     

    My question is about the '1234'. The number corresponds to an "id" which is a unique key in my database.

     

    When people make a post, I use LAST_INSERT_ID() to get the most recent post and generate the URL.

     

    So basically, my urls correspond 100% to database ID's, for better or worse. These go up by 1 with each post. I anticipate some potential numbering issues when I eventually delete posts.

     

    Would it be a better idea to generate these unique IDs some other way, or is this acceptable design?

     

    Thanks.

  3. 	if(get_images_for_delete($username, $newid, $mysqli) !== FALSE){
    	// WE are dealing with images
    	$images = get_images_for_delete($username, $newid, $mysqli);
    	$sourceBucket = "***********";
    	$targetBucket = "***********";
    	foreach($images as $image){
    	// copy our object
    	$aws = new s3;
    	$aws = $aws->copyObject($targetBucket, $image, $sourceBucket, $image);
    	// delete our object
    	$aws_delete = new s3;
    	$aws_delete = $aws_delete->deleteObject($image);
    	// copy our (thumbnail) object
    	$aws2 = new s3;
    	$aws2 = $aws2->copyObject($targetBucket, "thumb_".$image, $sourceBucket, "thumb_".$image);
    	// delete our (thumbnail) object
    	$aws_delete2 = new s3;
    	$aws_delete2 = $aws_delete2->deleteObject("thumb_".$image);
    	}
    
    

    Is my code. Do I need to declare so many new s3 classes? All the methods are within the same class. Not sure if this is the correct way to go about it.

  4. I have another thread, but it's on a different question.

    		// remake image
                    if(create_image($fileExt, $_FILES["myfile"]["tmp_name"], $_FILES["myfile"]["tmp_name"], 80) !== FALSE){
    		// generate thumbnail 
    		if(generatethumbs2('.'.$fileExt, $_FILES["myfile"]["tmp_name"], 120, $_FILES["myfile"]["tmp_name"], 85) == TRUE){
    			$aws = new s3;
    			$aws = $aws->putObject($newFileName, $_FILES["myfile"]["tmp_name"]);
    			image_string($username,$newFileName,$mysqli);
    			}
    		}
    

    Is my code.

     

    How do I access both the remade image AND the thumbnail? Currently, I can only access the thumbnail. I need to be able to access them concurrently for upload to Amazon s3.

     

     

     

  5. Any idea how to deal with multiple temp_names? For creation of image thumbnails:

    		if(create_image($fileExt, $_FILES["myfile"]["tmp_name"], $_FILES["myfile"]["tmp_name"], 80) !== FALSE){
    // the first function 'create_image' is working, but generate thumbs uses "tmp_name" twice
    		if(generatethumbs($_FILES["myfile"]["tmp_name"], 120, $_FILES["myfile"]["tmp_name"], 85) == TRUE){
    			$filelocation = $_FILES["myfile"]["tmp_name"];
    			$aws = new s3;
    			$aws = $aws->putObject($newFileName, $filelocation);
    			image_string($username,$newFileName,$mysqli);
    			}
    		}
    
  6. HI,

     

    I'm using;

    https://github.com/onassar/PHP-Pagination

     

    It works on my local test server, but on EC2, short tags are apparently not enabled by default.

     

    The pagination is printing php:

    <div class="pagination"><ul class="<?php= implode(' ', $classes) ?>">
    <li class="<?php= implode(' ', $classes) ?>"><a href="<?php= ($href) ?>"><?php= ($previous) ?></a></li>
    <li class="number active"><a data-pagenumber="<?php= ($current) ?>" href="#"><?php= ($current) ?></a></li>
    <li class="number"><a data-pagenumber="<?php= ($current + $x + 1) ?>" href="<?php= ($href) ?>"><?php= ($current + $x + 1) ?></a></li>
    <li class="number"><a data-pagenumber="<?php= ($current + $x + 1) ?>" href="<?php= ($href) ?>"><?php= ($current + $x + 1) ?></a></li>
    <li class="<?php= implode(' ', $classes) ?>"><a href="<?php= ($href) ?>"><?php= ($next) ?></a></li>
    

    I tried replacing <? with <?php to no avail. Not sure if the fact that one dependency is named "render.inc.php" instead of just ".php" which is causing the issue. Any ideas why apache is doing this? I'd rather not edit the .ini. Thanks..

  7. I created a PHP app, and now is time to deploy.

    Originally, the plan was just to get a good "x.large" EC2 instance and configure via FTP/SSH.

     

    Now I realize that that isn't the best idea, because EC2 instances are quite expensive, and may disappear without notice.

     

    So I heard of elastic beanstalk, with supposedly solves this problem. If true, this would be a HUGE help.

     

    My question is: How do I deploy a PHP app on elastic beanstalk? I heard it needs .WAR files (a Java thing), which obviously PHP doesn't provide.

     

    Also, since my app is using local file storage, I will need to rewrite it to use Amazon's S3 Bucket. Which is additional time.

     

     

  8. I'm building a site similiar to a web forum.

     

    The code is all done, this is how it works:

     

    CREATING POST:

    ------------------------

    In PHP:
    Create Post -> Upload Images

    -> Remake Images (For security)

    -> Create Thumbnails (saved in uploads folder with unique name)

     

    With DATABASE:

    I have a table called "images" which tracks user uploaded images:

    uploaded_by_username (stores who posted it)

    image_status (tracking whether user aborted upload)

    thumbnail_confirm (tracking whether thumbnail generated successfully)

    post_association (tracking the post that the images go to)

    image_name (the image filename in uploads filefolder)

    time (unix time-stamp of upload tracking for admin purposes)

     

    DELETING POST:

    ------------------------

    In PHP:

    Move all images into a "deleted_images" folder ( I'm afraid to use "unlink")

     

    With DATABASE:

    Delete all associated images from images table ( Is this risky? Should I use a second table and transfer the images? )

     

     

    Anyhow, feedback appreciated in regards to how I designed this. Is this acceptable for the industry?

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.