|
McGlockenshire posted:The code looks correct at first glance. Warning: session_start() [function.session-start]: open(/tmp/sess_8e01f9802198750c4bc92fa1c8c7c24a, O_RDWR) failed: Permission denied (13) in /home/client/public_html/xsuploader/index.php on line 2 I set /tmp in the linux root to 777 as well as the tmp in /home/client yet I'm still getting that error. It showed up when I set the PHP configuration to use DSO instead of SuPHP. Turning suExec on/off didn't seem to make a difference. Is there another easy upload bar that I could use as it seems like installing APC has become a headache in and of itself. e: on Chrome I get 0% before it successfully uploads and on firefox I get 1% before it uploads successfully on a 8mb upload. Master_Odin fucked around with this message at 17:46 on Jul 21, 2011 |
# ? Jul 21, 2011 17:19 |
|
|
# ? Jun 3, 2024 22:07 |
|
I want to roll out a framework for the site I've been fixed up with, it has only the barest of frameworks at the moment (every page includes a central file that sets a shitton of variables and includes a bunch of functions), and I want to bring it into the 21st century with separation of views, etc. Unfortunately, as some here know, I'm saddled with PHP 5.1.6. Meaning modern frameworks like Zend are probably off limits for me. Any suggestions on a framework, or on a good resource for me to learn how to roll my own simple one?
|
# ? Jul 21, 2011 20:44 |
|
Master_Odin posted:So I think I got it switched over to mod_php (it is available for the newest version of PHP right? I'm really rusty at this stuff) [...] It showed up when I set the PHP configuration to use DSO instead of SuPHP. Just to hone in on the APC issue, suPHP runs PHP as a CGI, not under mod_php. With regard to the session issue, are you running RHEL/CentOS? If so, is SELinux enabled? Check /var/log/audit/audit.log. Apache is probably forbidden from writing to /tmp. Golbez posted:Unfortunately, as some here know, I'm saddled with PHP 5.1.6. Any suggestions on a framework, or on a good resource for me to learn how to roll my own simple one?
|
# ? Jul 21, 2011 22:46 |
|
Golbez posted:I want to roll out a framework for the site I've been fixed up with, it has only the barest of frameworks at the moment (every page includes a central file that sets a shitton of variables and includes a bunch of functions), and I want to bring it into the 21st century with separation of views, etc. http://codeigniter.com/user_guide/general/requirements.html
|
# ? Jul 21, 2011 23:54 |
|
McGlockenshire posted:Just to hone in on the APC issue, suPHP runs PHP as a CGI, not under mod_php. e: I'm probably just going to relay this stuff to my client and tell him to contact his server provider to deal with this because gently caress trying to figure this poo poo out as I don't want to try and learn how to use/manage a server like this. Master_Odin fucked around with this message at 04:08 on Jul 22, 2011 |
# ? Jul 22, 2011 03:20 |
|
sold
|
# ? Jul 22, 2011 14:46 |
|
Master_Odin posted:I'm probably just going to relay this stuff to my client and tell him to contact his server provider to deal with this because gently caress trying to figure this poo poo out as I don't want to try and learn how to use/manage a server like this. For the audit log thing, you'd tail -f it while trying to write a session file, and see if there are new lines whining about crap. SELinux is a horrible thing.
|
# ? Jul 22, 2011 19:07 |
|
I have a question regarding PHP dynamically generated forms populated with data from a MySQL database. When using drop down boxes, how do you determine what value was already selected in the database and then make sure when the form loads that that is the value selected by default with selected="selected" in the <option> tag? I have a database with two tables and a relational link like the one in the below picture (role_id is linked to roles.id). So, first I pull the data into an array: php:<?php $sql = "SELECT name, role INNER JOIN roles ON role_id = roles.id"; $result = mysqli_query($link, $sql); $users = array(); while ($row = mysqli_fetch_array($result)) { $users[] = array('name' => $row['name'], 'role' => $row['role']); } $sql = "SELECT id, role FROM roles"; $result = mysqli_query($link, $sql); $roles = array(); while ($row = mysqli_fetch_array($result)) { $roles[] = array('id' => $row['id'], 'role' => $row['role']); } include 'form.html.php'; ?> Note: not sanitized for readability. php:<? <tbody> <?php foreach ($users as $user): ?> <tr> <form action="." method="post"> <td><input type="text" name="name" value="<?php echo $user['name']; ?>" /></td> <td><select value="role"> <?php foreach ($roles as $role): ?> <option value="<?php echo $role['id']; ?>"><?php echo $role['role']; ?></option> <?php endforeach; ?> </select></td> <td><input type="submit" name="action" value="Update" /></td> </form> </tr> <?php endforeach; ?> </tbody> ?>
|
# ? Jul 26, 2011 20:35 |
|
IT Guy posted:Here you go! php:<? <tbody> <?php foreach ($users as $user) { ?> <tr> <form action="." method="post"> <td><input type="text" name="name" value="<?php echo $user['name']; ?>" /></td> <td><select value="role"> <?php foreach ($roles as $role) { $selected = ($user['role'] == $role['id']) ? ' selected="selected"' : ''; ?> <option value="<?php echo $role['id']; ?>"<?php echo $selected; ?>><?php echo $role['role']; ?></option> <?php } ?> </select></td> <td><input type="submit" name="action" value="Update" /></td> </form> </tr> <?php } ?> </tbody> ?> DarkLotus fucked around with this message at 21:06 on Jul 26, 2011 |
# ? Jul 26, 2011 20:49 |
|
IT Guy posted:How do I add in a selected="selected" for my drop down item for the value in already in the database? You could compare the user's role to the roles as you populate the select box. Something like: php:<? ?> ... <option value="<?php echo $role['id']; ?>" <?php echo $user['role'] == $role['role'] ? 'selected="selected"' : ''; ><?php echo $role['role']; ?></option> ... <??>
|
# ? Jul 26, 2011 20:53 |
|
486 posted:You could compare the user's role to the roles as you populate the select box. Something like: Ah, this is exactly what I was looking for. Brain fart on my end because this is how I do my checkboxes. Thank you.
|
# ? Jul 26, 2011 21:06 |
|
DarkLotus posted:Here you go! Don't you find this <?php ... > ... <?php ... > ... <?php ... > all over the place kind of obnoxious? Not to mention that the opening and closing braces of the foreach construct are across different php tags. (I know that it's legal, but it's not really called for in this case and it makes the code so hard to read.) By all means drop out of php in order to echo larger chunks of static output, but isn't string concatenation more readable for these small strings? code:
|
# ? Jul 26, 2011 21:20 |
|
Hammerite posted:Don't you find this <?php ... > ... <?php ... > ... <?php ... > all over the place kind of obnoxious? Not to mention that the opening and closing braces of the foreach construct are across different php tags. (I know that it's legal, but it's not really called for in this case and it makes the code so hard to read.)
|
# ? Jul 26, 2011 21:23 |
|
I'm using this PHP/JavaScript framework called JFormer to make forms, and I'm getting a little burned out. http://www.jformer.com/documentation/basic-fields/file/ Anyone ever used this before? And if so, how do I actually write the goddamn file? I can only seem to access its properties (filename, type, size, etc).
|
# ? Jul 26, 2011 21:36 |
|
nevermind...
|
# ? Jul 26, 2011 21:44 |
|
Hammerite posted:Don't you find this <?php ... > ... <?php ... > ... <?php ... > all over the place kind of obnoxious? Not to mention that the opening and closing braces of the foreach construct are across different php tags. (I know that it's legal, but it's not really called for in this case and it makes the code so hard to read.) Personally I like to stay in HTML mode as much as possible because my text editor will highlight the syntax of the HTML correctly if I do that, which it can't if I just output strings. I don't have a problem with opening and closing braces in different foreach tags, as long as indentation is properly used so that the braces can be seen to match up with one another. php:<? <tbody> <?php foreach ($users as $user) { ?> <tr> <form action="." method="post"> <td><input type="text" name="name" value="<?php echo $user['name']; ?>" /></td> <td> <select value="role"> <?php foreach ($roles as $role) { $selected = ($user['role'] == $role['id']) ? ' selected="selected"' : ''; ?> <option value="<?php echo $role['id']; ?>" <?php echo $selected; ?> ><?php echo $role['role']; ?></option> <?php } ?> </select> </td> <td><input type="submit" name="action" value="Update" /></td> </form> </tr> <?php } ?> </tbody> ?>
|
# ? Jul 26, 2011 22:27 |
|
php:<? <tbody> <? foreach ($users as $user): ?> <tr> <form action="." method="post"> <td><input type="text" name="name" value="<?=$user['name']?>" /></td> <td> <select value="role"> <? foreach $roles as $role): ?> <option value="<?=$role['id']?>" <?=($user['role'] == $role['id']) ? 'selected="selected"' : ''?>> <?=$role['role']?> </option> <? endforeach; ?> </select> </td> <td><input type="submit" name="action" value="Update" /></td> </form> </tr> <? endforeach; ?> </tbody>
|
# ? Jul 26, 2011 22:44 |
|
Golbez posted:Cleaned that up for ya. Not a fan of the short open tags, but I do like how the resulting html source's whitespace doesn't get screwed up when you remove indentation from the foreaches. (in this example) Unfortunately, I just can't seem to bring myself to accept the indentation going back and forth when I am coding
|
# ? Jul 26, 2011 22:58 |
|
486 posted:Not a fan of the short open tags, but I do like how the resulting html source's whitespace doesn't get screwed up when you remove indentation from the foreaches. (in this example) Unfortunately, I just can't seem to bring myself to accept the indentation going back and forth when I am coding If not short open tags, then at least short echo tags. "<?php echo $foo;?>" vs "<?=$foo?>".
|
# ? Jul 26, 2011 23:08 |
|
Golbez posted:If not short open tags, then at least short echo tags. "<?php echo $foo;?>" vs "<?=$foo?>". I have come across servers do not have short echo tags turend on, and been through php upgrades to existing servers that flipped them off, and boy howdy, it's not worth the tiny number of keystrokes (but since you have an echo macro anyway, it's the same anyway) or "ugliness" for having your whole site / webapp die in flames.
|
# ? Jul 27, 2011 00:10 |
|
I'm back with more PDF issues; basically I've hit a brick wall atm. The client has a whole bunch of pdf forms that they want the user to be able to fill out an html form; and upon submit it emails a flat pdf to the client, and the user. Now the html form part is fine and dandy; the pdf is the issue. I can generate a fdf fine but they specifically want a pdf at the end of the process. I have no control over the hosting so I can't use pdftk ( which is what google and other places recommend ). This led me to: http://stackoverflow.com/questions/1389964/merge-fdf-data-into-a-pdf-file-using-php The second answer is what I'm interested in. I followed the instructions and came up with http://electronicmodesty.com/mergefdfwithpdf/ as a test case. Original PDF: http://electronicmodesty.com/mergefdfwithpdf/Project2.pdf Link to script: http://electronicmodesty.com/mergefdfwithpdf/Project2.pdf#FDF=generate_pdf_alt_2.php ( the script when directly link to runs and gives you a php file but really it's outputted as the resulting fdf ) Actual contents of script: code:
Also if theres another way to go about this I'm all ears. I'd rather not have to do actual PDF re-creation as we're talking about 25ish pdf's. I'm just looking for a way to merge a FDF with a PDF on the server side.
|
# ? Jul 27, 2011 01:43 |
|
Hammerite posted:Don't you find this <?php ... > ... <?php ... > ... <?php ... > all over the place kind of obnoxious? Not to mention that the opening and closing braces of the foreach construct are across different php tags. (I know that it's legal, but it's not really called for in this case and it makes the code so hard to read.) Yes, it is obnoxious, especially when I start putting htmlspecialchars($var, ENT_QUOTES, 'utf-8') around all my output variables as well. However, I was taught to keep my HTML and PHP as separate as possible and using controllers and then including HTML templates.
|
# ? Jul 27, 2011 12:51 |
|
I know there's a library on the net of newer PHP functions rewritten to allow them to work on older PHP versions. But I cannot seem to find the right string to use in Google to find it. Anyone know what I'm talking about? Edit: Aha, I had a version lying around. It's upgrade.php, http://upgradephp.berlios.de/. Golbez fucked around with this message at 19:37 on Jul 27, 2011 |
# ? Jul 27, 2011 17:59 |
|
PDO doesn't seem to accept constants when instantiating the object. Why? And what is the proper way to pass db config constants in?
|
# ? Jul 28, 2011 14:33 |
|
I'm a noob from the geocities days and I'm having trouble getting a site with the codeigniter framework to work properly. The company who made the site for my friend kindof jerked him around. It took legal threats to get them to deliver on the site, so while they claim it's complete who knows. I've uploaded the site folders to root on the server but when I go to the domain it gives me a 404 error. I am using a freehost site until I verify this site works and then I'll purchase a domain. I edited the config file to point to the correct domain. The php version running on the host is 5.2.17 so that shouldn't be a problem. Where should I start? I've never deployed a site using codeigniter before (php really at all). Thanks!
|
# ? Jul 28, 2011 21:47 |
|
michael30404 posted:I'm a noob from the geocities days and I'm having trouble getting a site with the codeigniter framework to work properly. The company who made the site for my friend kindof jerked him around. It took legal threats to get them to deliver on the site, so while they claim it's complete who knows. Did you put the actual site in /root or something like /home/username/public_html?
|
# ? Jul 29, 2011 01:51 |
|
I was sent a zip for the website. Upon opening the zip, there is a public folder and a log folder. I uploaded the contents of the public folder right to root. It contains assets and system folders, as well as index.php and htaccess file. The index file is just instructions for what I'm assuming is the CodeIgniter framework. The folder public>system>application>views> has php files that have actual content for the website. The index file in that directory (like in pretty much every directory) is a 403 message about forbidden access. When trying to access those files ie: domain.com/public/system/applications/views/contact.php I got the same 404 error.
|
# ? Jul 29, 2011 02:46 |
|
michael30404 posted:I was sent a zip for the website. Upon opening the zip, there is a public folder and a log folder. I uploaded the contents of the public folder right to root. It contains assets and system folders, as well as index.php and htaccess file. The index file is just instructions for what I'm assuming is the CodeIgniter framework. The folder public>system>application>views> has php files that have actual content for the website. The index file in that directory (like in pretty much every directory) is a 403 message about forbidden access. When trying to access those files ie: domain.com/public/system/applications/views/contact.php I got the same 404 error. What's the directory structure look like for your host? Are you uploading these files through FTP, SFTP, or something else?
|
# ? Jul 29, 2011 02:53 |
|
I'm uploading them by ftp. They are at the absolute root of the site. I'm beginning to think that the problem is my understanding of how a site using php is used at all. In angelfire days you upload an html file and that's what you go to. With these files I assumed that these people made something self-sufficient that I would only need to upload. I guess I don't understand how when you go to a domain one of the pages are referenced, or how you would even choose which page is referenced. I have not found an index file that actually contains content, or a home page. So It seems like there are two options: 1. These guys didn't make a complete site 2. I'm loving stupid and I won't be able to do this on my own, forcing someone to get involved. Let's take a vote.
|
# ? Jul 29, 2011 03:48 |
|
Can you post a link to the website? Or maybe tell us what folders you see when you initially login to the site through FTP.
|
# ? Jul 29, 2011 04:12 |
|
mailmanrob fucked around with this message at 22:46 on Feb 16, 2022 |
# ? Jul 29, 2011 04:37 |
|
I thought codeigniter didn't play well with most free hosts due to old versions of PHP running in safemode
|
# ? Jul 29, 2011 04:54 |
|
revmoo posted:PDO doesn't seem to accept constants when instantiating the object. Why? And what is the proper way to pass db config constants in? Can you give a code sample of what isn't working and what you'd expect to happen?
|
# ? Jul 29, 2011 04:59 |
|
Biowarfare posted:I thought codeigniter didn't play well with most free hosts due to old versions of PHP running in safemode Requirements say PHP version 5.1.6 or newer for the newest codeigniter build. The free host's version is 5.2.17.
|
# ? Jul 29, 2011 05:44 |
|
michael30404 posted:Requirements say PHP version 5.1.6 or newer for the newest codeigniter build. The free host's version is 5.2.17. Do this; Remove ALL the files you just uploaded. Write yourself a new index.php, with this in: php:<? phpinfo(); ?> Once you can get the phpinfo page up OK, remove the new index.php Upload the contents of the "public" folder to where the site worked from. load your domain again; http://www.yourdomain.com - you should get the front page. If it STILL doesn't work at all, remove the site again, go download codeigniter itself from http://codeigniter.com/, and upload the current base codeigniter install. Load your domain in a browser again; the default install should complain at you about anything it requires being missing. Once you can get the frontpage up OK, then you can go look into the application/controllers folder and application/config/routes.php file to figure out what other pages you've got. Note that if you have the "application" folder inside the "system" folder, this is built on an old version of codeigniter. You'll want to read: http://codeigniter.com/user_guide/general/urls.html http://codeigniter.com/user_guide/general/controllers.html http://codeigniter.com/user_guide/general/routing.html at a minimum to figure out how they've setup the site's urls and pages etc. you probably want to draw yourself some kind of sitemap from the controller and routing setup. for someone new to CI, figuring out the routing of an undocumented site is going to be annoying, I'm afraid. Edit; obviously the point of this is to isolate if your server is refusing to run CI, if you have the site in the wrong place for the URL you're trying to load, or if in fact you've been supplied a broken site. KuruMonkey fucked around with this message at 07:57 on Jul 29, 2011 |
# ? Jul 29, 2011 07:55 |
|
Thank you for all the advice. I'll try to get this going later today when I have time!
|
# ? Jul 29, 2011 15:28 |
|
hedgecore posted:I'm using this PHP/JavaScript framework called JFormer to make forms, and I'm getting a little burned out. DURRRRRRRRRRRRRRRR I forgot $_FILES existed. http://www.tizag.com/phpT/fileupload.php
|
# ? Jul 29, 2011 18:26 |
|
mailmanrob fucked around with this message at 22:08 on Feb 16, 2022 |
# ? Jul 30, 2011 01:51 |
|
Just pay for hosting or something. nfshost.com is less than $1 every few months if you're just playing around.
|
# ? Jul 30, 2011 04:41 |
|
|
# ? Jun 3, 2024 22:07 |
|
michael30404 posted:Just a quick update. I uploaded the PHP status file and it still gives 404 in the browser. You are almost certainly uploading outside of the document root; look for a folder called "htdocs" or "www" - if found; put stuff in there.
|
# ? Aug 1, 2011 11:22 |