php-general Digest 25 Aug 2012 08:10:18 -0000 Issue 7935
php-general Digest 25 Aug 2012 08:10:18 - Issue 7935 Topics (messages 318811 through 318834): Re: Dynamic Content thoughts 318811 by: Samuel Lopes Grigolato 318812 by: Matijn Woudt 318813 by: Jim Lucas 318814 by: David OBrien 318815 by: Jim Lucas 318816 by: Matijn Woudt 318817 by: Jim Lucas 318818 by: Matijn Woudt 318819 by: tamouse mailing lists 318820 by: tamouse mailing lists 318821 by: tamouse mailing lists 318822 by: tamouse mailing lists 318823 by: tamouse mailing lists 318824 by: tamouse mailing lists 318825 by: Jim Lucas 318826 by: Jim Lucas 318827 by: tamouse mailing lists 318828 by: Matijn Woudt 318829 by: Jim Lucas 318830 by: Matijn Woudt away from Fedora linux for a while and now this ...HELP 318831 by: Fred Silsbee 318832 by: Sebastian Krebs 318834 by: Ashley Sheridan UTC on php log bug 318833 by: MartÃn Marqués Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Do you mean the quotation marks? Have you tried to create a simple Notepad++ macro? I do this for things like formatting SQL from SQL Editor to SQL String in code, and vice versa. Cheers. -Mensagem original- De: tamouse mailing lists [mailto:tamouse.li...@gmail.com] Enviada em: sexta-feira, 24 de agosto de 2012 12:02 Para: php-gene...@lists.php.net Assunto: Re: [PHP] Dynamic Content thoughts OT Reply -- just frustrated with the way email screws up program listings. It's a royal pain to have to strip out code and then put it in an editor and tidy it up just to be able to make heads or tails out of something. There are lots of code pasting sites around, but that breaks up the continuity of the list archive. No solution, just frustrated -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- On Fri, Aug 24, 2012 at 5:01 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: OT Reply -- just frustrated with the way email screws up program listings. It's a royal pain to have to strip out code and then put it in an editor and tidy it up just to be able to make heads or tails out of something. There are lots of code pasting sites around, but that breaks up the continuity of the list archive. No solution, just frustrated You're absolutely right, it frustrates me too pretty often. Perhaps we should make it a guideline to do both? The active followers will be able to read the code at one of the code pasting sites, and the archives still have the code. - Matijn ---End Message--- ---BeginMessage--- On 08/24/2012 08:01 AM, tamouse mailing lists wrote: OT Reply -- just frustrated with the way email screws up program listings. It's a royal pain to have to strip out code and then put it in an editor and tidy it up just to be able to make heads or tails out of something. There are lots of code pasting sites around, but that breaks up the continuity of the list archive. No solution, just frustrated This list does allow attachments, but that breaks things too, because they are not shown on archive web sites. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ My test attachment ---End Message--- ---BeginMessage--- On Fri, Aug 24, 2012 at 11:16 AM, Jim Lucas li...@cmsws.com wrote: On 08/24/2012 08:01 AM, tamouse mailing lists wrote: OT Reply -- just frustrated with the way email screws up program listings. It's a royal pain to have to strip out code and then put it in an editor and tidy it up just to be able to make heads or tails out of something. There are lots of code pasting sites around, but that breaks up the continuity of the list archive. No solution, just frustrated This list does allow attachments, but that breaks things too, because they are not shown on archive web sites. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php In gmail if I see something is totally screwed up visually I click the little dropdown where you'd select reply to all and then choose show original... It shows the source of the email in monospaced font so if looks like it was meant to ---End Message--- ---BeginMessage--- Two simple guide lines will help everybody here. 1) Limit your lines to 80 characters 2) Use spaces instead of Tabs -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ ---End Message--- ---BeginMessage--- On Fri, Aug 24, 2012 at 5:22 PM, Jim Lucas
Re: [PHP] away from Fedora linux for a while and now this ...HELP
On Sat, 2012-08-25 at 01:54 +0200, Sebastian Krebs wrote: Am 25.08.2012 01:41, schrieb Fred Silsbee: Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/var/www/html/log_book_MySQL.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0 had to use Fedora yumex(yum) to install php PHP Version 5.4.5 is seen in phpinfo before now, php was there and ready after Fedora install Hi, I guess you created the file yourself (with your user account) and want to watch it within your browser via your webserver? The last one usually runs under the www-data:www-data (debian. Guess Fedora takes it similar) user:group. So, either change the owner, or change the permissions. An example | chmod g+rw /var/www/html/log_book_MySQL.php | chown www-data:www-data /var/www/html/log_book_MySQL.php and add yourself to the group www-data. Don't know, how it can be done in Fedora. Debian uses usermod, but as far as I know it's a debian tool(?). Regards, Sebastian It could also be good ol' SELinux getting in the way. Sometimes (on a whim it seems) it denies access to a file completely. You need to set the extra permissions that SELinux uses on that file, or disable SELinux completely. I ended up going the disable route as this is also my desktop machine, and SELinx wasn't playing nice with other apps like Chrome. -- Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] Re: Using PEAR and PHP
Hi Suraj, take my advice: read the Manual! Greets Carlos Am 23.08.2012 19:42, schrieb Suraj Shah: Hi. I am currently working on a website which uses PHP as an integral programming language as part of it. I am trying to replicate the website’s contents from one ftp server to another but am encountering serious issues in doing so. I’ve spent two days trying to find out the reasons and now think its down to the PEAR installation. This is therefore a question on if I want to transfer a website from one domain to another, then do I need to install PEAR and re-configure all the files? At the moment, all I can see within the ftp client regarding PEAR are the ‘Mail’ and ‘Mail_Mime’ components. I am new to this so any help on this would be great. Many thanks Suraj Suraj Shah Online Marketing Executive 26 Throgmorton Street | London | EC2N 2AN t: 020 7826 9031 e: su...@aifa.net w: www.aifa.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: set up mass virtual hosting with apache/nginx and PHP ... best practice2012?
Hi, Read the Apache and PHP Documentation, if you have any questions after this. write again... Greets Carlos Am 22.08.2012 01:26, schrieb D. Dante Lorenso: All, I need to set up a server to enable 5,000 students to have web hosting provided by the school with PHP and MySQL support. I'm trying to figure out what is the best way to do this. We have Active Directory and are using Centrify to authenticate usernames and passwords on our Linux servers. I am imagining it would be great if we use something like ExecCGI to ensure that PHP runs as the user that owns the files. We would then provide FTP access to the files and FTP would authenticate against Active Directory making sure to set the proper user/group on files when uploaded. I see that PHP-FPM exists: http://php-fpm.org and it claims Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode) which is exactly what I'm looking for. It also claims PHP-FPM is now included in PHP core as of PHP 5.3.3. so that's good. I also read about the greatness that is NGinX: http://nginx.org though I don't know if I can use it because I think I also need to use .htaccess files. I need a way for students to be able to password protect their directories and files. If there's another way using NGinX or Apache, that's good too. I know of no other way. Here is an interesting article from 2009: http://www.howtoforge.com/how-to-set-up-mass-virtualhosting-with-apache2-mod_rewrite-mod_userdir-mod_suexec-on-centos-5.3 That uses mod_rewrite to attempt something like what I'm trying to do ... and then, Apache has mod_vhost_alias: http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html So, I see a lot of information out there. Apache, NginX, ExecCGI, FastCGI, mod_vhost_alias, mod_rewrite, SuExec, mod_userdir. I suspect some of these methods are old and out of date. In my ideal situation: - users would be created in AD and would exist on the OS - student domain names would look like: http://username.student.school.edu/ - OR - http://student.school.edu/username/ - file directories would look like: /mnt/somedir/username/docroot - students would be able to create PHP applications executed with their own permissions - I would be able to configure all 5,000 accounts with a single configuration (1 virtual host rule?) Do you know what the best practices are for now ... here in 2012? -- Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] away from Fedora linux for a while and now this ...HELP
On Sat, Aug 25, 2012 at 1:54 AM, Sebastian Krebs krebs@gmail.com wrote: Am 25.08.2012 01:41, schrieb Fred Silsbee: Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/var/www/html/log_book_MySQL.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0 had to use Fedora yumex(yum) to install php PHP Version 5.4.5 is seen in phpinfo before now, php was there and ready after Fedora install Hi, I guess you created the file yourself (with your user account) and want to watch it within your browser via your webserver? The last one usually runs under the www-data:www-data (debian. Guess Fedora takes it similar) user:group. So, either change the owner, or change the permissions. An example | chmod g+rw /var/www/html/log_book_MySQL.php | chown www-data:www-data /var/www/html/log_book_MySQL.php and add yourself to the group www-data. Don't know, how it can be done in Fedora. Debian uses usermod, but as far as I know it's a debian tool(?). Regards, Sebastian I don't use Fedora, but I doubt that would be necessary. All files created by a user account have read rights for world, atleast on all the Unix servers/PCs I maintain. Maybe it's just a typo? Linux is case sensitive, so make sure the file is really called log_book_MySQL.php, and not log_book_MYSQL.php for example.. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: set up mass virtual hosting with apache/nginx and PHP ... best practice2012?
On Sat, Aug 25, 2012 at 11:09 AM, Carlos Medina i...@simply-networks.de wrote: Hi, Read the Apache and PHP Documentation, if you have any questions after this. write again... Greets Carlos OT: Carlos, There's no need to write useless replies like this (also on other topics). I'm pretty sure there's no answer to his question in the manual. He explicitly asks for help and experiences for PHP with ~5.000 virtual hosts. Also, you should bottom post on this, and probably any, mailing list. Am 22.08.2012 01:26, schrieb D. Dante Lorenso: All, I need to set up a server to enable 5,000 students to have web hosting provided by the school with PHP and MySQL support. I'm trying to figure out what is the best way to do this. We have Active Directory and are using Centrify to authenticate usernames and passwords on our Linux servers. I am imagining it would be great if we use something like ExecCGI to ensure that PHP runs as the user that owns the files. We would then provide FTP access to the files and FTP would authenticate against Active Directory making sure to set the proper user/group on files when uploaded. I see that PHP-FPM exists: http://php-fpm.org and it claims Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode) which is exactly what I'm looking for. It also claims PHP-FPM is now included in PHP core as of PHP 5.3.3. so that's good. I also read about the greatness that is NGinX: http://nginx.org though I don't know if I can use it because I think I also need to use .htaccess files. I need a way for students to be able to password protect their directories and files. If there's another way using NGinX or Apache, that's good too. I know of no other way. Here is an interesting article from 2009: http://www.howtoforge.com/how-to-set-up-mass-virtualhosting-with-apache2-mod_rewrite-mod_userdir-mod_suexec-on-centos-5.3 That uses mod_rewrite to attempt something like what I'm trying to do ... and then, Apache has mod_vhost_alias: http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html So, I see a lot of information out there. Apache, NginX, ExecCGI, FastCGI, mod_vhost_alias, mod_rewrite, SuExec, mod_userdir. I suspect some of these methods are old and out of date. In my ideal situation: - users would be created in AD and would exist on the OS - student domain names would look like: http://username.student.school.edu/ - OR - http://student.school.edu/username/ - file directories would look like: /mnt/somedir/username/docroot - students would be able to create PHP applications executed with their own permissions - I would be able to configure all 5,000 accounts with a single configuration (1 virtual host rule?) Do you know what the best practices are for now ... here in 2012? -- Dante Hi Dante, Wouldn't it be much easier to use reseller packages like DirectAdmin or cPanel? AFAIK it should be pretty easy to do the things above. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] set up mass virtual hosting with apache/nginx and PHP ... best practice 2012?
From my experience to maintain many virtual host, I prefer use Apache + PHP + suPHP. I think this combination will be able to cover your ideal situation above. But, I usually use authentication via shell user (/etc/user). You must find tutorial or something that integrate Apache and Active Directory (there are many out there). suPHP is designed to replace suExec (default Apache mod). It will run a PHP file as a user that own the files. There are no problem if you want to use it for many user, because suPHP is designed for that. For user who will uploade file, you can always use FTP to access their own file. Each user can has their own .htaccess in their own directory and all the websites will have one global rule in httpd.conf. On Wed, Aug 22, 2012 at 6:26 AM, D. Dante Lorenso da...@lorenso.com wrote: All, I need to set up a server to enable 5,000 students to have web hosting provided by the school with PHP and MySQL support. I'm trying to figure out what is the best way to do this. We have Active Directory and are using Centrify to authenticate usernames and passwords on our Linux servers. I am imagining it would be great if we use something like ExecCGI to ensure that PHP runs as the user that owns the files. We would then provide FTP access to the files and FTP would authenticate against Active Directory making sure to set the proper user/group on files when uploaded. I see that PHP-FPM exists: http://php-fpm.org and it claims Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode) which is exactly what I'm looking for. It also claims PHP-FPM is now included in PHP core as of PHP 5.3.3. so that's good. I also read about the greatness that is NGinX: http://nginx.org though I don't know if I can use it because I think I also need to use .htaccess files. I need a way for students to be able to password protect their directories and files. If there's another way using NGinX or Apache, that's good too. I know of no other way. Here is an interesting article from 2009: http://www.howtoforge.com/how-**to-set-up-mass-virtualhosting-** with-apache2-mod_rewrite-mod_**userdir-mod_suexec-on-centos-**5.3http://www.howtoforge.com/how-to-set-up-mass-virtualhosting-with-apache2-mod_rewrite-mod_userdir-mod_suexec-on-centos-5.3 That uses mod_rewrite to attempt something like what I'm trying to do ... and then, Apache has mod_vhost_alias: http://httpd.apache.org/docs/**2.2/mod/mod_vhost_alias.htmlhttp://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html So, I see a lot of information out there. Apache, NginX, ExecCGI, FastCGI, mod_vhost_alias, mod_rewrite, SuExec, mod_userdir. I suspect some of these methods are old and out of date. In my ideal situation: - users would be created in AD and would exist on the OS - student domain names would look like: http://username.student.**school.edu/http://student.school.edu/- OR - http://student.school.edu/**username/ - file directories would look like: /mnt/somedir/username/**docroot - students would be able to create PHP applications executed with their own permissions - I would be able to configure all 5,000 accounts with a single configuration (1 virtual host rule?) Do you know what the best practices are for now ... here in 2012? -- Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Duken Marga
Re: [PHP] away from Fedora linux for a while and now this ...HELP
Am 25.08.2012 13:04, schrieb Matijn Woudt: On Sat, Aug 25, 2012 at 1:54 AM, Sebastian Krebs krebs@gmail.com wrote: Am 25.08.2012 01:41, schrieb Fred Silsbee: Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/var/www/html/log_book_MySQL.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0 had to use Fedora yumex(yum) to install php PHP Version 5.4.5 is seen in phpinfo before now, php was there and ready after Fedora install Hi, I guess you created the file yourself (with your user account) and want to watch it within your browser via your webserver? The last one usually runs under the www-data:www-data (debian. Guess Fedora takes it similar) user:group. So, either change the owner, or change the permissions. An example | chmod g+rw /var/www/html/log_book_MySQL.php | chown www-data:www-data /var/www/html/log_book_MySQL.php and add yourself to the group www-data. Don't know, how it can be done in Fedora. Debian uses usermod, but as far as I know it's a debian tool(?). Regards, Sebastian I don't use Fedora, but I doubt that would be necessary. All files created by a user account have read rights for world, atleast on all the Unix servers/PCs I maintain. This depends on the umask. One may come to the conclusion to secure a system by setting a more restrictive umask (which is at all not that bad idea) and then some days/weeks/months later he realizes, that something stoped working. Changing the umask is useful, if you have many different users and you want them to be more separated from each others. Maybe it's just a typo? Linux is case sensitive, so make sure the file is really called log_book_MySQL.php, and not log_book_MYSQL.php for example.. Good point too :D - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] redefine a define ...
I know the response that I will get on the internals list, so I'll put this one past readers here ... I've just switched to overhauling a commerce package extension to the framework that I'm upgrading to be E_STRICT complaint, and I've hit a little snag. The original designers took the approach of doing the language translations as define() constants with your just selecting the language to load. The problem comes with the fact that they load a generic file, and then follow it by additional defines for more accurate text ... overloading the generic copy ... What I was not expecting was a string of 'Notices:' complaining about the redefines. So how does one get around this message? One can't 'if defined' as the string needs to be replaced with the more appropriate one. I would say, why is this even a problem, or alternatively I just give up on E_STRICT and make sure it's disabled again on PHP5.4? Having spent several months getting the code clean on E_STRICT, switching it off again will really pig me off, but I can't see any real alternative given the number of languages and strings that will need reworking simply to get things clean :( -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redefine a define ...
On Sat, Aug 25, 2012 at 2:27 PM, Lester Caine les...@lsces.co.uk wrote: What I was not expecting was a string of 'Notices:' complaining about the redefines. So how does one get around this message? One can't 'if defined' as the string needs to be replaced with the more appropriate one. I would say, why is this even a problem, or alternatively I just give up on E_STRICT and make sure it's disabled again on PHP5.4? Having spent several months getting the code clean on E_STRICT, switching it off again will really pig me off, but I can't see any real alternative given the number of languages and strings that will need reworking simply to get things clean :( Well, I'd do the following to avoid issues in the future. 1) Create a function like that below, which provides global access to variables and allows you to update existing values: function val($name, $value = null) { static $values = array(); if ($value === null) { return isset($values[$name]) ? $values[$name] : null; } else { return $values[$name]; } } 2) Create a php script that searches out define(SOME_NAME_PATTERN, value) and replaces that with val(some_name_pattern, value). 3) Create a php script that searches out SOME_NAME_PATTERN and replaces with val(SOME_NAME_PATTERN); Not too bad in terms of work, as PHP's parsing capabilities are really nice. Hope this gives you ideas :) Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redefine a define ...
Op 25 aug. 2012 21:03 schreef Adam Richardson simples...@gmail.com het volgende: On Sat, Aug 25, 2012 at 2:27 PM, Lester Caine les...@lsces.co.uk wrote: What I was not expecting was a string of 'Notices:' complaining about the redefines. So how does one get around this message? One can't 'if defined' as the string needs to be replaced with the more appropriate one. I would say, why is this even a problem, or alternatively I just give up on E_STRICT and make sure it's disabled again on PHP5.4? Having spent several months getting the code clean on E_STRICT, switching it off again will really pig me off, but I can't see any real alternative given the number of languages and strings that will need reworking simply to get things clean :( Well, I'd do the following to avoid issues in the future. 1) Create a function like that below, which provides global access to variables and allows you to update existing values: function val($name, $value = null) { static $values = array(); if ($value === null) { return isset($values[$name]) ? $values[$name] : null; } else { return $values[$name]; } } 2) Create a php script that searches out define(SOME_NAME_PATTERN, value) and replaces that with val(some_name_pattern, value). 3) Create a php script that searches out SOME_NAME_PATTERN and replaces with val(SOME_NAME_PATTERN); Not too bad in terms of work, as PHP's parsing capabilities are really nice. Hope this gives you ideas :) Adam That's probably quite some work given the many defines.. Fact is, constants are, as the name says, constant. Would it be possible to just not include the general file? Second, though not 100% sure if it works for E_STRICT is using @ before all defines to silence the warning. You could do a simple replace for that.. - Matijn
Re: [PHP] redefine a define ...
Can you just switch the order? Instead of... define(SOME_CONSTANT,Generic Value); define(SOME_CONSTANT,Override Value); Why not do... define(SOME_CONSTANT,Override Value); if(!defined(SOME_CONSTANT)) { define(SOME_CONSTANT,Generic Value); } This should avoid any redefinition and thus the notices. Matt On Sat, Aug 25, 2012 at 3:07 PM, Matijn Woudt tijn...@gmail.com wrote: Op 25 aug. 2012 21:03 schreef Adam Richardson simples...@gmail.com het volgende: On Sat, Aug 25, 2012 at 2:27 PM, Lester Caine les...@lsces.co.uk wrote: What I was not expecting was a string of 'Notices:' complaining about the redefines. So how does one get around this message? One can't 'if defined' as the string needs to be replaced with the more appropriate one. I would say, why is this even a problem, or alternatively I just give up on E_STRICT and make sure it's disabled again on PHP5.4? Having spent several months getting the code clean on E_STRICT, switching it off again will really pig me off, but I can't see any real alternative given the number of languages and strings that will need reworking simply to get things clean :( Well, I'd do the following to avoid issues in the future. 1) Create a function like that below, which provides global access to variables and allows you to update existing values: function val($name, $value = null) { static $values = array(); if ($value === null) { return isset($values[$name]) ? $values[$name] : null; } else { return $values[$name]; } } 2) Create a php script that searches out define(SOME_NAME_PATTERN, value) and replaces that with val(some_name_pattern, value). 3) Create a php script that searches out SOME_NAME_PATTERN and replaces with val(SOME_NAME_PATTERN); Not too bad in terms of work, as PHP's parsing capabilities are really nice. Hope this gives you ideas :) Adam That's probably quite some work given the many defines.. Fact is, constants are, as the name says, constant. Would it be possible to just not include the general file? Second, though not 100% sure if it works for E_STRICT is using @ before all defines to silence the warning. You could do a simple replace for that.. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: set up mass virtual hosting with apache/nginx and PHP ... best practice2012?
On 8/25/12 6:11 AM, Matijn Woudt wrote: Hi Dante, Wouldn't it be much easier to use reseller packages like DirectAdmin or cPanel? AFAIK it should be pretty easy to do the things above. I'm considering that as well. In the end, I really only want 3 features, however: - ftp access to files - mysql database - apache/php support Look at DirectAdmin features: http://www.directadmin.com/features.html Looks like 80-90% of that is not needed. I want to manage my users through Active Directory, and just enable or disable the 3 services I listed above. I recently tested ISP Manager. Their trial license couldn't even be installed without a public IP address! I don't want to get into these games. Just some simple, clean, open source solutions, please :-) Also, I intend to make this solution scalable. I have 2 HA load balancers that will distribute the web load across multiple web servers. Licensing starts to get expensive when you begin to think clusters or clouds. I want to scale without additional licensing costs. I'll install DirectAdmin and cPanel now that you recommend them, however, to make sure I don't actually want them :-) -- Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redefine a define ...
On Sat, 2012-08-25 at 15:17 -0400, Matt Neimeyer wrote: Can you just switch the order? Instead of... define(SOME_CONSTANT,Generic Value); define(SOME_CONSTANT,Override Value); Why not do... define(SOME_CONSTANT,Override Value); if(!defined(SOME_CONSTANT)) { define(SOME_CONSTANT,Generic Value); } This should avoid any redefinition and thus the notices. Matt On Sat, Aug 25, 2012 at 3:07 PM, Matijn Woudt tijn...@gmail.com wrote: Op 25 aug. 2012 21:03 schreef Adam Richardson simples...@gmail.com het volgende: On Sat, Aug 25, 2012 at 2:27 PM, Lester Caine les...@lsces.co.uk wrote: What I was not expecting was a string of 'Notices:' complaining about the redefines. So how does one get around this message? One can't 'if defined' as the string needs to be replaced with the more appropriate one. I would say, why is this even a problem, or alternatively I just give up on E_STRICT and make sure it's disabled again on PHP5.4? Having spent several months getting the code clean on E_STRICT, switching it off again will really pig me off, but I can't see any real alternative given the number of languages and strings that will need reworking simply to get things clean :( Well, I'd do the following to avoid issues in the future. 1) Create a function like that below, which provides global access to variables and allows you to update existing values: function val($name, $value = null) { static $values = array(); if ($value === null) { return isset($values[$name]) ? $values[$name] : null; } else { return $values[$name]; } } 2) Create a php script that searches out define(SOME_NAME_PATTERN, value) and replaces that with val(some_name_pattern, value). 3) Create a php script that searches out SOME_NAME_PATTERN and replaces with val(SOME_NAME_PATTERN); Not too bad in terms of work, as PHP's parsing capabilities are really nice. Hope this gives you ideas :) Adam That's probably quite some work given the many defines.. Fact is, constants are, as the name says, constant. Would it be possible to just not include the general file? Second, though not 100% sure if it works for E_STRICT is using @ before all defines to silence the warning. You could do a simple replace for that.. - Matijn I think the point is that the code is relying on overriding the constants, so that wouldn't help at all. I think the best thing would be to re-write the code, constants are never meant to be treated like that, it's entirely the opposite of what a constant is. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] set up mass virtual hosting with apache/nginx and PHP ... best practice 2012?
On 8/25/12 7:50 AM, Duken Marga wrote: From my experience to maintain many virtual host, I prefer use Apache + PHP + suPHP. I think this combination will be able to cover your ideal situation above. But, I usually use authentication via shell user (/etc/user). You must find tutorial or something that integrate Apache and Active Directory (there are many out there). suPHP is designed to replace suExec (default Apache mod). It will run a PHP file as a user that own the files. There are no problem if you want to use it for many user, because suPHP is designed for that. For user who will uploade file, you can always use FTP to access their own file. Each user can has their own .htaccess in their own directory and all the websites will have one global rule in httpd.conf. Using VirtualDocumentRoot, I was able to create a virtual host defined like this: VirtualHost *:80 ServerName student.sampledomain.edu ServerAlias *.student.sampledomain.edu DocumentRoot /mnt/web/student.sampledomain.edu/docroot UseCanonicalName Off VirtualDocumentRoot /mnt/userwww/%-4+ ErrorLog |/usr/bin/logger -p local6.notice -t 'error-student' CustomLog |/usr/bin/logger -p local6.notice -t 'access-student' full /VirtualHost That maps domain names like username.student.sampledomain.edu to directories in the /mnt/userwww/username directory. That gets me close, but isn't handling PHP yet. I think Apache also runs as 'apache' user when reading all the files, so users must chmod their files world readable still for this to work. You reference suPHP as the way to go. The problem I have with that is this website: http://www.suphp.org/Home.html Looks like the last update was back in 2009. That's more than 3 years ago. I think that project has stalled. There must be something newer that has replaced it since then. -- Dante On Wed, Aug 22, 2012 at 6:26 AM, D. Dante Lorenso da...@lorenso.com mailto:da...@lorenso.com wrote: All, I need to set up a server to enable 5,000 students to have web hosting provided by the school with PHP and MySQL support. I'm trying to figure out what is the best way to do this. We have Active Directory and are using Centrify to authenticate usernames and passwords on our Linux servers. I am imagining it would be great if we use something like ExecCGI to ensure that PHP runs as the user that owns the files. We would then provide FTP access to the files and FTP would authenticate against Active Directory making sure to set the proper user/group on files when uploaded. I see that PHP-FPM exists: http://php-fpm.org and it claims Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode) which is exactly what I'm looking for. It also claims PHP-FPM is now included in PHP core as of PHP 5.3.3. so that's good. I also read about the greatness that is NGinX: http://nginx.org though I don't know if I can use it because I think I also need to use .htaccess files. I need a way for students to be able to password protect their directories and files. If there's another way using NGinX or Apache, that's good too. I know of no other way. Here is an interesting article from 2009: http://www.howtoforge.com/how-__to-set-up-mass-virtualhosting-__with-apache2-mod_rewrite-mod___userdir-mod_suexec-on-centos-__5.3 http://www.howtoforge.com/how-to-set-up-mass-virtualhosting-with-apache2-mod_rewrite-mod_userdir-mod_suexec-on-centos-5.3 That uses mod_rewrite to attempt something like what I'm trying to do ... and then, Apache has mod_vhost_alias: http://httpd.apache.org/docs/__2.2/mod/mod_vhost_alias.html http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html So, I see a lot of information out there. Apache, NginX, ExecCGI, FastCGI, mod_vhost_alias, mod_rewrite, SuExec, mod_userdir. I suspect some of these methods are old and out of date. In my ideal situation: - users would be created in AD and would exist on the OS - student domain names would look like: http://username.student.__school.edu/ http://student.school.edu/ - OR - http://student.school.edu/__username/ - file directories would look like: /mnt/somedir/username/__docroot - students would be able to create PHP applications executed with their own permissions - I would be able to configure all 5,000 accounts with a single configuration (1 virtual host rule?) Do you know what the best practices are for now ... here in 2012? -- Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Duken Marga -- Dante D. Dante Lorenso -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redefine a define ...
Ashley Sheridan wrote: I think the point is that the code is relying on overriding the constants, so that wouldn't help at all. I think the best thing would be to re-write the code, constants are never meant to be treated like that, it's entirely the opposite of what a constant is. I've 45 languages and several hundred strings per language ;) Redefining 'define' as a new function is looking the easiest option as I can just replace all the defines in the language files. Then simply run a clean set of defines as I can't easily replace all of that text in the rest of the code tree :( I can see why the approach was taken originally as it READS a lot better than building the translations as an array of strings which is used in other packages. There are only some 800 strings to be reworked later ... across a few hundred files ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A quick ereg translation
ereg('body(.*)/body', $phpinfo, $regs); Pulls the body of phpinfo() to use with a tidy header of other system information, but I'm struggling to get a pcre alternative. Anybody already cracked this one? -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A quick ereg translation
Am 25.08.2012 23:06, schrieb Lester Caine: ereg('body(.*)/body', $phpinfo, $regs); Pulls the body of phpinfo() to use with a tidy header of other system information, but I'm struggling to get a pcre alternative. Anybody already cracked this one? usually it's just fine to wrap the pattern into delimiter. | preg_match('~body(.*)/body~i', $phpinfo, $regs); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] A quick ereg translation
You're correct in the fact that you've added delimiters to the pattern, however you also need to specify the s pattern modifier so that the search spans over multiple lines. This should do the trick: preg_match('#body(.*)/body#is', $content, $matches); --- Date: Sat, 25 Aug 2012 23:10:08 +0200 From: krebs@gmail.com To: php-general@lists.php.net Subject: Re: [PHP] A quick ereg translation Am 25.08.2012 23:06, schrieb Lester Caine: ereg('body(.*)/body', $phpinfo, $regs); Pulls the body of phpinfo() to use with a tidy header of other system information, but I'm struggling to get a pcre alternative. Anybody already cracked this one? usually it's just fine to wrap the pattern into delimiter. | preg_match('~body(.*)/body~i', $phpinfo, $regs); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] syntax error breaking in and out of php into html code
I've just inherited some (pretty awful code) that I have to make some edits to, and came across a bit of a problem. A lot of the code breaks in and out of PHP and into HTML code: ?php while(condition) { ? lisome html here/li ?php } ? But when I check this my PHP parser is saying that this is a syntax error (checked in the browser and CLI). I know this is code from a working site, so it must be a setting within my PHP configuration. Now, I'm intending to re-write this anyway, as the logic is all over the place (SQL queries within the HTML, no separation of code and content, dozens of warnings all over the place) but I was wondering what setting causes this. It's mostly a curiosity thing really, as this thing is going to be re-written faster than an school project the eve before hand-in. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] A quick ereg translation
SagaciousDev PHP-Dev wrote: This should do the trick: preg_match('#body(.*)/body#is', $content, $matches); TA - That has got it ;) That is tidier than what I had ended up with ... #body([^\']*?)\/body# from a 'tutorial' -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax error breaking in and out of php into html code
On Sat, Aug 25, 2012 at 6:54 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: I've just inherited some (pretty awful code) that I have to make some edits to, and came across a bit of a problem. A lot of the code breaks in and out of PHP and into HTML code: ?php while(condition) { ? lisome html here/li ?php } ? But when I check this my PHP parser is saying that this is a syntax error (checked in the browser and CLI). I know this is code from a working site, so it must be a setting within my PHP configuration. I honestly can't think of a config setting that would cause a syntax error for this type of example. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] set up mass virtual hosting with apache/nginx and PHP ... best practice 2012?
On Sun, Aug 26, 2012 at 2:30 AM, D. Dante Lorenso da...@lorenso.com wrote: Using VirtualDocumentRoot, I was able to create a virtual host defined like this: VirtualHost *:80 ServerName student.sampledomain.edu ServerAlias *.student.sampledomain.edu DocumentRoot /mnt/web/student.sampledomain.**edu/docroothttp://student.sampledomain.edu/docroot UseCanonicalName Off VirtualDocumentRoot /mnt/userwww/%-4+ ErrorLog |/usr/bin/logger -p local6.notice -t 'error-student' CustomLog |/usr/bin/logger -p local6.notice -t 'access-student' full /VirtualHost That maps domain names like username.student.**sampledomain.eduhttp://student.sampledomain.eduto directories in the /mnt/userwww/username directory. That gets me close, but isn't handling PHP yet. I think Apache also runs as 'apache' user when reading all the files, so users must chmod their files world readable still for this to work. I don't know what you means isn't handling PHP yet. If you want Apache handling a PHP program, you must integrate PHP and Apache, in FreeBSD and Apache, these lines must be written in httpd.conf: # Apache 2.x LoadModule php5_modulelibexec/apache/libphp5.so AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps The above lines will tell apache to execute php file as a PHP program. For your latest statement, Yes, default Apache will handling program as 'apache' user. But, if you use suPHP, suExec, or other similiar program, the file will be execute as a user that own the files. So, in other words, you must use 'chown' program to assure the php files is own by the right user. The files still readable with that program if you use secure and right mode with 'chmod' program. For security reason, you must always use 755 for directory and mode 644 for files. You reference suPHP as the way to go. The problem I have with that is this website: http://www.suphp.org/Home.html Looks like the last update was back in 2009. That's more than 3 years ago. I think that project has stalled. There must be something newer that has replaced it since then. I think the suPHP project is not dead yet. It's because the program is small and just doing a simple task and if the suPHP program still work for the latest Apache today, why do we must question it? Even small notepad from 10 years ago can still be used today, right? If you want advanced and simple task to manage files for each user, you must buy commercial program like cPanel or Plesk. -- Duken Marga
Re: [PHP] syntax error breaking in and out of php into html code
Can you tell us what is the error shown in browser or CLI? On Sun, Aug 26, 2012 at 5:54 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: I've just inherited some (pretty awful code) that I have to make some edits to, and came across a bit of a problem. A lot of the code breaks in and out of PHP and into HTML code: ?php while(condition) { ? lisome html here/li ?php } ? But when I check this my PHP parser is saying that this is a syntax error (checked in the browser and CLI). I know this is code from a working site, so it must be a setting within my PHP configuration. Now, I'm intending to re-write this anyway, as the logic is all over the place (SQL queries within the HTML, no separation of code and content, dozens of warnings all over the place) but I was wondering what setting causes this. It's mostly a curiosity thing really, as this thing is going to be re-written faster than an school project the eve before hand-in. -- Thanks, Ash http://www.ashleysheridan.co.uk -- Duken Marga
Re: [PHP] syntax error breaking in and out of php into html code
On Sun, 2012-08-26 at 09:41 +0700, Duken Marga wrote: Can you tell us what is the error shown in browser or CLI? On Sun, Aug 26, 2012 at 5:54 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: I've just inherited some (pretty awful code) that I have to make some edits to, and came across a bit of a problem. A lot of the code breaks in and out of PHP and into HTML code: ?php while(condition) { ? lisome html here/li ?php } ? But when I check this my PHP parser is saying that this is a syntax error (checked in the browser and CLI). I know this is code from a working site, so it must be a setting within my PHP configuration. Now, I'm intending to re-write this anyway, as the logic is all over the place (SQL queries within the HTML, no separation of code and content, dozens of warnings all over the place) but I was wondering what setting causes this. It's mostly a curiosity thing really, as this thing is going to be re-written faster than an school project the eve before hand-in. -- Thanks, Ash http://www.ashleysheridan.co.uk Through the browser I get: Parse error: syntax error, unexpected $end in /var/www/html/siteinquestion/index.php on line 356 Through the CLI I get: PHP Parse error: syntax error, unexpected $end in index.php on line 356 Parse error: syntax error, unexpected $end in index.php on line 356 Errors parsing index.php I've narrowed it down to the lines that used the breaking in and out of PHP style. As soon as I comment out those it runs fine, albeit without the content that code was intended to add. -- Thanks, Ash http://www.ashleysheridan.co.uk