Jump to content

mcastles

Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Posts posted by mcastles

  1. For anyone interested... I have come up with a workaround to convert link, meta and break return tags to have closing slashes.

     

    $search = array('/<link(.*)>/i','/<meta(.*)>/i','/<br(.*)>/i');
    $replace = array('<link$1/>','<meta$1/>','<br$1/>');
    $html = preg_replace($search,$replace, $html);
    

  2. if your using apache use mod_rewrite.

     

    something like:

     

    # Set the default handler.
    DirectoryIndex index.php
    
    #  mod_rewrite in use
    RewriteEngine On
    
    #  Uncomment following line if your webserver's URL
    #  is not directly related to physival file paths.
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    

     

    in a .htaccess file will redirect the url to be parsed by index.php

  3. did you try specifying the directory to save in relation to where the php file is?

    <?php
    $save = '../../thumbnails/t_'.$file; //back two directories and into the thumbnail directory
    ?>
    

    whats the error that you get? is your new directory chmoded?

     

    you might also want to try an absolute path:

    <?php
    $save = './thumbnails/t_'.$file; //into thumbnail directory that is located in the root of the website.
    ?>
    

     

  4. Hi,

     

    I've been using DomDocument in PHP5 and its been working really well. I just have a few questions about it:

     

    I'm loading a html file using:

    $dom = new DomDocument();
    @$dom->loadHTMLFile("html.html");

    then I'm modifying the domdocument and then save the html using:

    echo $dom->saveHTML();

     

    This all works fine and I'm fairly happy with it. The only issue I have is that the new output generates invalide html code. Basically link tags and meta tags don't have closing tags anymore. For example..

     

    The original html file might have some link tags like this:

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <link rel="stylesheet" type="text/css" href="default.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="print.css" media="print" />
    

     

    but after loading and saving with DomDocument it outputs like this:

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <link rel="stylesheet" type="text/css" href="default.css" media="screen">
    <link rel="stylesheet" type="text/css" href="print.css" media="print">
    

     

    Has anyone come accross this and know a workaround?

     

    Oh, and one other thing:

     

    does $dom->formatOutput = true; and $dom->preserveWhiteSpace = false; do anything for loaded html files? I can't seem to get it to modify the output at all.

  5. *******************EDIT**********************

    Opps... the title is meant to be.. installing php4 and php5 simultaneosly

    *******************EDIT**********************

     

     

    I have been trying different methods to run php 4 and 5 simultaneosly but it won't work sadly.

     

    The method I like the best is this one here: =linear#comments]http://blog.rayh.co.uk/index.php?url=archives/13-PHP5-amp;-PHP4-side-by-side.html&serendipity[cview]=linear#comments

     

    php4 runs fine on my server so thats all good.

     

    So far this is what I'm doing to get php5 working.. (or trying to get it working.)

     

    unpack php5 source

     

    run configure...

    ./configure \

    --with-xml \

    --with-dom \

    --with-mysql=shared\

    --with-bzip \

    --with-gd \

    --with-bzip \

    --with-gd \

    --with-zlib \

    --with-openssl \

    --with-gettext --enable-mailparse \

    --with-curl \

    --with-png \

    --with-jpeg-dir=/usr/local/lib/ \

    --with-png-dir=/usr/local/ \

    --with-freetype-dir=/usr/local/ \

    --without-pear \

    --without-sqlite \

    --enable-shared-pdflib \

    --enable-force-cgi-redirect \

    --enable-gd-native-ttf \

    --enable-versioning \

    --enable-mbstring \

    --enable-memory-limit \

    --enable-safe-mode \

    --enable-exif \

    --prefix=/usr/local/php5 \

    --with-config-file=/etc/php5.ini

     

    make

     

    make install

     

    cp php.ini-recommended /etc/php5.ini

     

    set include_path in /etc/php5.ini...

    include_path = "/usr/local/php5/lib/php"

     

    add the following to script alias section of httpd.conf...

    ScriptAlias /cgi-php5/ "/usr/local/php5/bin/"

    <Directory "/usr/local/php5/bin">

    Options +ExecCGI

    Allow From All

    </Directory>

     

    goto my website httpdocs directory...

    mkdir php5

    cd php5

     

    create .htaccess with..

    Action php5-script /cgi-php5/php

    AddHandler php5-script .php

    Options +ExecCGI

     

    create index.php with..

    <?php

    phpinfo();

    ?>

     

    restart apache...

    apachectl graceful

     

    so far.. it all compiles happily and seems to be fine. When I try and navigate to the php5 folder I get an internal server error. The message says to check the server error log which I can't find.

     

    Has anyone got any suggestions on what I should do to get it working?

     

    thanks,

     

    Marc

×
×
  • 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.