php-general Digest 2 May 2012 06:45:47 -0000 Issue 7796

Topics (messages 317727 through 317734):

Re: code deployment through php
        317727 by: Camilo Sperberg
        317728 by: rene7705
        317729 by: Stuart Dallas
        317730 by: admin
        317731 by: Larry Garfield
        317732 by: Lester Caine

Re: PHP Mailto() - Google now displaying HTML as Plain Text
        317733 by: Marco Behnke

problem loading php extension: undefined reference to __gxx_personality_v0þ
        317734 by: Nathan Ridge

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


----------------------------------------------------------------------
--- Begin Message ---
On 1 mei 2012, at 10:59, rene7705 wrote:

> Hi folks.
> 
> I was here a while ago, trying to figure out how to keep deployment
> instances of my common code, running on more than 1 site, in sync with
> eachother.
> 
> I've looked at rsync which was recommended here, but didn't like it much,
> nor could I find a good windows version of it.
> 
> So yesterday, I decided to try a pure PHP solution. My thinking was: run a
> PHP sync script once on each physical machine that holds possibly multiple
> copies of my common code, and FTP the common code only 1 time because I use
> only 1 shared hosting account besides my windows development machine.
> 
> I've gotten it so far that it creates an imo good list of what to copy
> where.
> 
> The only problem I can foresee is that the copy command will take more than
> 30 seconds, which makes it hard to run at the shared hoster.
> 
> And obviously, it's going to need some good input checking to prevent
> abuse.
> 
> I've put up a demo at
> http://skatescene.biz/sites/mediabeez.ws/sync_secret_cndj593n2/ , you can
> "execute" the "code" job to see it in action.
> 
> I'll also post the working copy of my sync library at the bottom of this
> post. The only thing missing is the actual copy($source,$dest), I think.
> 
> But, I'm wondering if this is a good approach to code deployment. It
> certainly seems easier and more convenient to me than using rsync. Maybe
> i'm an amateur indeed ;)  Anyways, all criticism is welcome here. Thanks
> for your time! :)
> 
> <?php
> function sync_echo_jobs ($path) {
> $jobs = sync_read_jobs ($path);
> echo '<div id="rajmvSync_jobs_json"><!-- '.json_encode($jobs).' --></div>';
> echo '<ul class="rajmvSync_jobs">';
> foreach ($jobs['jobs'] as $jobName => $job) {
> echo '<li>'.$jobName.' (<a
> href="javascript:rscg.executeJob(\''.$jobName.'\');">execute</a>) (<a
> href="javascript:rscg.showEditJobForm(\''.$jobName.'\');">edit</a>)</li>';
> }
> echo '</ul>';
> ?>
> <?php
> }
> 
> function sync_read_jobs ($path) {
> $filepath = $path.'/rajmvSync_jobs.json';
> if (file_exists($filepath)) {
> $r = json_decode (file_get_contents($filepath), true);
> } else {
> $r = array (
> 'jobs' => array()
> );
> }
> return $r;
> }
> 
> function sync_write_jobs ($path, $jobs) {
> $filepath = $path.'/rajmvSync_jobs.json';
> file_put_contents ($filepath, json_encode($jobs));
> }
> 
> function sync_addOrEditJob ($path, $name, $paths) {
> $jobs = sync_read_jobs ($path);
> $jobs['jobs'][$name] = array (
> 'paths' => $paths
> );
> sync_write_jobs ($path, $jobs);
> }
> 
> function sync_executeJob ($path, $name) {
> $jobs = sync_read_jobs ($path);
> if (array_key_exists($name, $jobs['jobs'])) {
> $job = $jobs['jobs'][$name];
> $paths = explode ("\n", $job['paths']);
> // work only on approved paths;
> $pathsApproved = array();
> foreach ($paths as $idx=>$pathToSync) {
> $drive = strtolower(substr($pathToSync,0,2));
> if ($drive=='m:') $pathsApproved[]=$pathToSync;
> }
> $paths = $pathsApproved;
> 
> // get a list of files for each path to sync with the other paths in the
> same list/var
> $fileLists = array();
> foreach ($paths as $idx => $pathToSync) {
> $fileLists[$pathToSync] = getFilePathList ($pathToSync, true, "/(.*)/",
> array('file'));
> }
> // get all the last modified timestamps for each of the found files
> $fileList = array();
> foreach ($paths as $idx => $pathToSync) {
> foreach ($fileLists[$pathToSync] as $idx2 => $filepathToSync) {
> $fileRelativePath = str_replace ($pathToSync, '', $filepathToSync);
> if (!array_key_exists($fileRelativePath, $fileList))
> $fileList[$fileRelativePath] = array();
> $fileList[$fileRelativePath][$pathToSync] = filemtime($filepathToSync);
> }
> }
> // $copyList will hold all the copy commands, initialize;
> $copyList = array();
> foreach ($fileList as $fileRelativePath => $locationResults) {
> foreach ($locationResults as $pathToSync => $filemtime) {
> if (!array_key_exists($fileRelativePath, $copyList))
> $copyList[$fileRelativePath] = array(
> 'latest' => null,
> 'source' => null,
> 'destinations' => array()
> );
> if (is_null($copyList[$fileRelativePath]['latest']) || $filemtime >
> $copyList[$fileRelativePath]['latest']) {
> $copyList[$fileRelativePath]['source'] = $pathToSync;
> $copyList[$fileRelativePath]['latest'] = $filemtime;
> }
> }
> }
> 
> // schedule copy command for all files with older filemtime() than the
> latest copy
> foreach ($fileList as $fileRelativePath => $locationResults) {
> foreach ($locationResults as $pathToSync => $filemtime) {
> if ($filemtime < $copyList[$fileRelativePath]['latest']) {
> $copyList[$fileRelativePath]['destinations'][] = $pathToSync;
> }
> }
> }
> // schedule copy command for all new files that must go to all $pathToSync
> where it is not present yet:
> foreach ($copyList as $fileRelativePath => $fileRec) {
> if (count($fileList[$fileRelativePath])!=count($paths)) {
> foreach ($paths as $idx=>$pathToSync) {
> if (!array_key_exists($pathToSync, $fileList[$fileRelativePath]))
> $copyList[$fileRelativePath]['destinations'][] = $pathToSync;
> }
> }
> }
> 
> // debug output of actual copy commands
> foreach ($copyList as $fileRelativePath => $fileRec) {
> if (count($fileRec['destinations'])>0) {
> echo $fileRec['source'].$fileRelativePath.' : ';
> var_dump ($fileRec['destinations']);
> }
> }
> }
> }
> ?>


PD::: Forgot to copy it to the list, my apologies
-----

If I understood the problem correctly, you want to keep a single copy of your 
code on every machine you work, including the final server. 

Have you read about SVN ? You can set up a cronjob to execute it automatically 
if you want, there are clients for Windows, Zend Studio, etc etc. 

Greetings.

--- End Message ---
--- Begin Message ---
On Tue, May 1, 2012 at 11:11 AM, Camilo Sperberg <unrea...@gmail.com> wrote:

> If I understood the problem correctly, you want to keep a single copy of
> your code on every machine you work, including the final server.
>
>
Well, I want to work on 1 copy of my common code on my windows machine,
then sync those changes to all my sites (hosted on the win dev box) to see
if it messes up the other sites, then FTP those changes to my hosting
account, and run the sync script there as well.


> Have you read about SVN ? You can set up a cronjob to execute it
> automatically if you want, there are clients for Windows, Zend Studio, etc
> etc.
>

I've read about some source control systems, I've tried them out, but I'd
rather go for this simpler approach tbh.
I already do regular backups that are timestamped, it's enough for me right
now I think.

--- End Message ---
--- Begin Message ---
On 1 May 2012, at 10:19, rene7705 wrote:

> On Tue, May 1, 2012 at 11:11 AM, Camilo Sperberg <unrea...@gmail.com> wrote:
> 
>> If I understood the problem correctly, you want to keep a single copy of
>> your code on every machine you work, including the final server.
>> 
>> 
> Well, I want to work on 1 copy of my common code on my windows machine,
> then sync those changes to all my sites (hosted on the win dev box) to see
> if it messes up the other sites, then FTP those changes to my hosting
> account, and run the sync script there as well.
> 
> 
>> Have you read about SVN ? You can set up a cronjob to execute it
>> automatically if you want, there are clients for Windows, Zend Studio, etc
>> etc.
>> 
> 
> I've read about some source control systems, I've tried them out, but I'd
> rather go for this simpler approach tbh.
> I already do regular backups that are timestamped, it's enough for me right
> now I think.

If you really think rolling your own deployment system is simpler than using 
source control then I don't think you've understood all of the advantages of 
source control. I know it can look complicated, but it's really not, and it 
will make it far easier to keep track of what you're doing and what changes are 
deployed where than the system you described. I strongly recommend you 
reconsider.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Stuart Dallas [mailto:stu...@3ft9.com] 
Sent: Tuesday, May 01, 2012 8:19 AM
To: rene7705
Cc: Camilo Sperberg; php-general
Subject: Re: [PHP] code deployment through php

On 1 May 2012, at 10:19, rene7705 wrote:

> On Tue, May 1, 2012 at 11:11 AM, Camilo Sperberg <unrea...@gmail.com>
wrote:
> 
>> If I understood the problem correctly, you want to keep a single copy 
>> of your code on every machine you work, including the final server.
>> 
>> 
> Well, I want to work on 1 copy of my common code on my windows 
> machine, then sync those changes to all my sites (hosted on the win 
> dev box) to see if it messes up the other sites, then FTP those 
> changes to my hosting account, and run the sync script there as well.
> 
> 
>> Have you read about SVN ? You can set up a cronjob to execute it 
>> automatically if you want, there are clients for Windows, Zend 
>> Studio, etc etc.
>> 
> 
> I've read about some source control systems, I've tried them out, but 
> I'd rather go for this simpler approach tbh.
> I already do regular backups that are timestamped, it's enough for me 
> right now I think.

If you really think rolling your own deployment system is simpler than using
source control then I don't think you've understood all of the advantages of
source control. I know it can look complicated, but it's really not, and it
will make it far easier to keep track of what you're doing and what changes
are deployed where than the system you described. I strongly recommend you
reconsider.

-Stuart

--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/




Stuart,
        If I may add to your post
 
Version control for different environments (Development and Production) is
SO key with SVN.
SVN has logging and other key features. 

Many, and when I say many that is an understatement, Many companies enforce
SVN for their protection.

Ever had a script not fully transfer, and only partial code remains?
With SVN you can roll it back and Whala! You have the original source back.

For one of my roles as Project Manager, I love Tortoise SVN. I have changed
the scripting a bit to send me emails with descriptions of changes as they
happen with attached files.
This way I can actually filter my emails to find the exact person who made
the bad change, what they had, and what they did instead of searching the
logs.

Since my developers can only push to the Development Servers I can fix
issues before they become a Production Issue.
No more, Developers having access to the server directly. They make their
changes and commit their changes up, I review and can schedule changes to be
committed to Production Servers.
To setup a new Developer I simply check out the SVN library for them and
they are up to speed day one.

The setup is very easy, Yes the controls are a tiny bit confusing at FIRST. 
But if you want success, then SVN is a SMART decision for any project.




Richard Buskirk














--- End Message ---
--- Begin Message ---
On 5/1/12 4:19 AM, rene7705 wrote:
On Tue, May 1, 2012 at 11:11 AM, Camilo Sperberg<unrea...@gmail.com>  wrote:

If I understood the problem correctly, you want to keep a single copy of
your code on every machine you work, including the final server.


Well, I want to work on 1 copy of my common code on my windows machine,
then sync those changes to all my sites (hosted on the win dev box) to see
if it messes up the other sites, then FTP those changes to my hosting
account, and run the sync script there as well.


Have you read about SVN ? You can set up a cronjob to execute it
automatically if you want, there are clients for Windows, Zend Studio, etc
etc.


I've read about some source control systems, I've tried them out, but I'd
rather go for this simpler approach tbh.
I already do regular backups that are timestamped, it's enough for me right
now I think.

No it's not. Really. For what you describe, a proper version control system is the correct tool. Rolling your own with rsync and cron is setting yourself up for failure.

A couple people here have mentioned SVN. I used to use SVN, but now have migrated everything I do to Git. Without getting into a religious battle between Git and SVN, I do strongly recommend you look into it. This is an excellent resource for why to use it and how to use it:

http://progit.org/book

If you're serious about development, get serious about version control.

--Larry Garfield

--- End Message ---
--- Begin Message ---
rene7705 wrote:
Well, I want to work on 1 copy of my common code on my windows machine,
then sync those changes to all my sites (hosted on the win dev box) to see
if it messes up the other sites, then FTP those changes to my hosting
account, and run the sync script there as well.

I have a number of windows based customers who also like to review what we are doing, so I ended up with HG. TortoiseHg provides a nice gui based DVCS system interface on Windows which works identically on Linux and I can push and pull changes around the place without having to worry about anything.

The servers 'pull' a copy of the code base from a local server master, which is managed from the development environment. Config information is protected on each site, and the whole thing works identically on both windows and linux so I don't have to worry what the customers are using. THEY can work to their own site and change what we give them access to, while the core code is managed from the central repo.

If they come up with something useful it can be merged back into the master copy :) One of the few pieces of software I actually pay for is BeyondCompare which provides the same cross platform facilities for merging files and with it's built in ftp interface allows manually inspecting the file structure on any of the machines. A couple of my Mac based customers are now investigating the same development base.

Add Eclipse/PHPEclipse on top and you have the ultimate cross platform IDE :)

--
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//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---


Am 29.04.2012 22:31, schrieb Terry Ally (Gmail):
Hi all,

I have been using a mailto() script for the last three years and from April
25, 2012 incoming HTML email in Goggle mail is displaying as Plain Text.
  Something clearly changed with Google. Perhaps there is some change I need
to make with my script??

$message .= "<p><b>Message:</b><blockquote>  ".$m."</blockquote></p>";


As far as I can see your main html tags are missing?

$message = '<html><body>' . $message . '</body></html>';


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz


Attachment: smime.p7s
Description: S/MIME Kryptografische Unterschrift


--- End Message ---
--- Begin Message ---
Hi,
 
I'm having trouble loading a PHP extension that I made. 
When starting PHP, I get the following error:
 
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/lib/php5/20090626/libtg.so' - /usr/lib/php5/20090626/libtg.so: undefined 
symbol: __gxx_personality_v0 in Unknown on line 0
 
libtg.so is my extension. It is a wrapper around a C++ library, made
using SWIG (http://www.swig.org/).
 
I know __gxx_personality_v0 is a symbol from libstdc++, but my extension,
libtg.so, is linked to libstdc++. I have confirmed this using ldd:
 
$ ldd libtg.so
linux-vdso.so.1 =>  (0x00007fff5f932000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f3fc937c000)
libm.so.6 => /lib/libm.so.6 (0x00007f3fc90f9000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f3fc8ee2000)
libc.so.6 => /lib/libc.so.6 (0x00007f3fc8b5f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3fc98fc000)
 
Any ideas as to why PHP is not finding this symbol, or how I can further 
diagnose the problem?
 
Thanks,
Nate                                      

--- End Message ---

Reply via email to